qchart.h
99 lines
| 2.8 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> | ||
|
r87 | #include <QFont> | ||
|
r12 | |||
|
r30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||
|
r12 | |||
|
r67 | class AxisItem; | ||
|
r21 | class QChartSeries; | ||
|
r67 | class PlotDomain; | ||
|
r56 | class BarGroup; | ||
|
r72 | class QChartAxis; | ||
|
r103 | class ChartTheme; | ||
|
r104 | class ChartObjectInterface; | ||
|
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: | ||
|
r86 | enum GradientOrientation { | ||
HorizonatlGradientOrientation, | ||||
VerticalGradientOrientation | ||||
}; | ||||
|
r75 | enum ChartThemeId { | ||
|
r103 | ChartThemeInvalid = -1, | ||
|
r81 | /*! The default theme follows the GUI style of the Operating System */ | ||
|
r103 | ChartThemeDefault, | ||
|
r81 | ChartThemeVanilla, | ||
|
r64 | ChartThemeIcy, | ||
|
r77 | ChartThemeGrayscale, | ||
|
r81 | //ChartThemeScientific, | ||
|
r77 | ChartThemeUnnamed1 | ||
|
r64 | }; | ||
|
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; | ||
|
r75 | void setTheme(QChart::ChartThemeId theme); | ||
|
r28 | |||
|
r87 | void setTitle(const QString& title,const QFont& font = QFont()); | ||
|
r86 | void setBackground(const QColor& startColor, const QColor& endColor = Qt::white, GradientOrientation orientation = VerticalGradientOrientation); | ||
|
r69 | |||
|
r67 | void zoomInToRect(const QRect& rectangle); | ||
void zoomIn(); | ||||
void zoomOut(); | ||||
|
r93 | void zoomReset(); | ||
|
r67 | |||
|
r85 | void setAxisX(const QChartAxis& axis); | ||
void setAxisY(const QChartAxis& axis); | ||||
void setAxisY(const QList<QChartAxis>& axis); | ||||
|
r72 | |||
|
r85 | private: | ||
void setAxis(AxisItem *item, const QChartAxis& axis); | ||||
|
r72 | |||
|
r12 | private: | ||
|
r28 | Q_DISABLE_COPY(QChart) | ||
|
r87 | QGraphicsRectItem* m_backgroundItem; | ||
|
r69 | QLinearGradient m_backgroundGradient; | ||
|
r86 | GradientOrientation m_bacgroundOrinetation; | ||
|
r87 | QGraphicsTextItem* m_titleItem; | ||
AxisItem* m_axisXItem; | ||||
QList<AxisItem*> m_axisYItem; | ||||
|
r53 | QRect m_rect; | ||
|
r103 | QList<QChartSeries *> m_chartSeries; | ||
|
r104 | QList<ChartObjectInterface *> m_chartObjectInterfaces; | ||
|
r67 | QVector<PlotDomain> m_plotDomainList; | ||
|
r53 | int m_plotDataIndex; | ||
int m_marginSize; | ||||
|
r103 | ChartTheme *m_chartTheme; | ||
|
r12 | }; | ||
|
r30 | QTCOMMERCIALCHART_END_NAMESPACE | ||
|
r12 | |||
#endif | ||||