qchart.h
92 lines
| 2.3 KiB
| text/x-c
|
CLexer
/ src / qchart.h
|
r12 | #ifndef CHART_H | ||
#define CHART_H | ||||
|
r30 | #include <qchartglobal.h> | ||
|
r42 | #include <qchartseries.h> | ||
|
r48 | #include <QGraphicsObject> | ||
|
r69 | #include <QLinearGradient> | ||
|
r12 | |||
|
r30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||
|
r12 | |||
|
r67 | class AxisItem; | ||
|
r21 | class QChartSeries; | ||
|
r67 | class PlotDomain; | ||
class ChartItem; | ||||
|
r56 | class BarGroup; | ||
|
r72 | class QChartAxis; | ||
|
r21 | |||
|
r42 | // TODO: We don't need to have QChart tied to QGraphicsItem: | ||
//class QTCOMMERCIALCHART_EXPORT QChart | ||||
//class QTCOMMERCIALCHART_EXPORT QChartGraphicsItem : public QGraphicsItem { | ||||
// public: QChartGraphicsItem(QChart &chart); | ||||
/*! | ||||
* TODO: define the responsibilities | ||||
*/ | ||||
|
r48 | class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsObject | ||
|
r38 | { | ||
|
r48 | Q_OBJECT | ||
|
r64 | public: | ||
enum ChartTheme { | ||||
ChartThemeVanilla = 0, | ||||
ChartThemeIcy, | ||||
ChartThemeGrayscale | ||||
}; | ||||
|
r12 | public: | ||
|
r48 | QChart(QGraphicsObject* parent = 0); | ||
~QChart(); | ||||
|
r12 | |||
|
r21 | //from QGraphicsItem | ||
|
r48 | QRectF boundingRect() const; | ||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){}; | ||||
|
r21 | |||
void addSeries(QChartSeries* series); | ||||
|
r42 | //TODO: QChartSeries* createSeries(QSeriesData *data, QChartSeries::QChartSeriesType type); | ||
// TODO: who owns the series now? maybe owned by chart and returned a reference instead... | ||||
|
r61 | QChartSeries* createSeries(QChartSeries::QChartSeriesType type); | ||
|
r12 | |||
|
r67 | void setSize(const QSize& size); | ||
|
r12 | void setMargin(int margin); | ||
|
r28 | int margin() const; | ||
|
r64 | void setTheme(QChart::ChartTheme theme); | ||
|
r28 | |||
|
r69 | void setTitle(const QString& title); | ||
void setBackgroundColor(const QColor& color); | ||||
|
r67 | void zoomInToRect(const QRect& rectangle); | ||
void zoomIn(); | ||||
void zoomOut(); | ||||
|
r72 | void setAxisX(QChartAxis* axis){}; | ||
void setAxisY(QChartAxis* axis){}; | ||||
void setAxisY(QList<QChartAxis*> axis){}; | ||||
|
r48 | signals: | ||
|
r67 | //TODO chage to const QSize& size | ||
|
r54 | void sizeChanged(QRectF rect); | ||
void scaleChanged(qreal xscale, qreal yscale); | ||||
|
r12 | |||
private: | ||||
|
r28 | Q_DISABLE_COPY(QChart) | ||
|
r69 | QGraphicsRectItem* m_background; | ||
QLinearGradient m_backgroundGradient; | ||||
QGraphicsTextItem* m_title; | ||||
|
r67 | AxisItem* m_axisX; | ||
AxisItem* m_axisY; | ||||
|
r53 | QRect m_rect; | ||
QList<const QChartSeries*> m_series; | ||||
|
r67 | QVector<PlotDomain> m_plotDomainList; | ||
QList<ChartItem*> m_chartItems; | ||||
//TODO: remove | ||||
|
r53 | QList<QGraphicsItem*> m_items; | ||
int m_plotDataIndex; | ||||
int m_marginSize; | ||||
|
r64 | QList<QColor> m_themeColors; | ||
|
r56 | QList<BarGroup*> m_BarGroupItems; | ||
|
r12 | }; | ||
|
r30 | QTCOMMERCIALCHART_END_NAMESPACE | ||
|
r12 | |||
#endif | ||||