qchart.h
99 lines
| 2.8 KiB
| text/x-c
|
CLexer
/ src / qchart.h
Michal Klocek
|
r12 | #ifndef CHART_H | ||
#define CHART_H | ||||
Tero Ahola
|
r30 | #include <qchartglobal.h> | ||
Tero Ahola
|
r42 | #include <qchartseries.h> | ||
Tero Ahola
|
r48 | #include <QGraphicsObject> | ||
Michal Klocek
|
r69 | #include <QLinearGradient> | ||
Michal Klocek
|
r87 | #include <QFont> | ||
Michal Klocek
|
r12 | |||
Tero Ahola
|
r30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||
Michal Klocek
|
r12 | |||
Michal Klocek
|
r67 | class AxisItem; | ||
Michal Klocek
|
r21 | class QChartSeries; | ||
Michal Klocek
|
r67 | class PlotDomain; | ||
sauimone
|
r56 | class BarGroup; | ||
Michal Klocek
|
r72 | class QChartAxis; | ||
Tero Ahola
|
r103 | class ChartTheme; | ||
class ChartItemControl; | ||||
Michal Klocek
|
r21 | |||
Tero Ahola
|
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 | ||||
*/ | ||||
Tero Ahola
|
r48 | class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsObject | ||
Tero Ahola
|
r38 | { | ||
Tero Ahola
|
r48 | Q_OBJECT | ||
Tero Ahola
|
r64 | public: | ||
Michal Klocek
|
r86 | enum GradientOrientation { | ||
HorizonatlGradientOrientation, | ||||
VerticalGradientOrientation | ||||
}; | ||||
Tero Ahola
|
r75 | enum ChartThemeId { | ||
Tero Ahola
|
r103 | ChartThemeInvalid = -1, | ||
Tero Ahola
|
r81 | /*! The default theme follows the GUI style of the Operating System */ | ||
Tero Ahola
|
r103 | ChartThemeDefault, | ||
Tero Ahola
|
r81 | ChartThemeVanilla, | ||
Tero Ahola
|
r64 | ChartThemeIcy, | ||
Tero Ahola
|
r77 | ChartThemeGrayscale, | ||
Tero Ahola
|
r81 | //ChartThemeScientific, | ||
Tero Ahola
|
r77 | ChartThemeUnnamed1 | ||
Tero Ahola
|
r64 | }; | ||
Michal Klocek
|
r12 | public: | ||
Tero Ahola
|
r48 | QChart(QGraphicsObject* parent = 0); | ||
~QChart(); | ||||
Michal Klocek
|
r12 | |||
Michal Klocek
|
r21 | //from QGraphicsItem | ||
Tero Ahola
|
r48 | QRectF boundingRect() const; | ||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){}; | ||||
Michal Klocek
|
r21 | |||
void addSeries(QChartSeries* series); | ||||
Tero Ahola
|
r42 | //TODO: QChartSeries* createSeries(QSeriesData *data, QChartSeries::QChartSeriesType type); | ||
// TODO: who owns the series now? maybe owned by chart and returned a reference instead... | ||||
Tero Ahola
|
r61 | QChartSeries* createSeries(QChartSeries::QChartSeriesType type); | ||
Michal Klocek
|
r12 | |||
Michal Klocek
|
r67 | void setSize(const QSize& size); | ||
Michal Klocek
|
r12 | void setMargin(int margin); | ||
Michal Klocek
|
r28 | int margin() const; | ||
Tero Ahola
|
r75 | void setTheme(QChart::ChartThemeId theme); | ||
Michal Klocek
|
r28 | |||
Michal Klocek
|
r87 | void setTitle(const QString& title,const QFont& font = QFont()); | ||
Michal Klocek
|
r86 | void setBackground(const QColor& startColor, const QColor& endColor = Qt::white, GradientOrientation orientation = VerticalGradientOrientation); | ||
Michal Klocek
|
r69 | |||
Michal Klocek
|
r67 | void zoomInToRect(const QRect& rectangle); | ||
void zoomIn(); | ||||
void zoomOut(); | ||||
Tero Ahola
|
r93 | void zoomReset(); | ||
Michal Klocek
|
r67 | |||
Michal Klocek
|
r85 | void setAxisX(const QChartAxis& axis); | ||
void setAxisY(const QChartAxis& axis); | ||||
void setAxisY(const QList<QChartAxis>& axis); | ||||
Michal Klocek
|
r72 | |||
Michal Klocek
|
r85 | private: | ||
void setAxis(AxisItem *item, const QChartAxis& axis); | ||||
Michal Klocek
|
r72 | |||
Michal Klocek
|
r12 | private: | ||
Michal Klocek
|
r28 | Q_DISABLE_COPY(QChart) | ||
Michal Klocek
|
r87 | QGraphicsRectItem* m_backgroundItem; | ||
Michal Klocek
|
r69 | QLinearGradient m_backgroundGradient; | ||
Michal Klocek
|
r86 | GradientOrientation m_bacgroundOrinetation; | ||
Michal Klocek
|
r87 | QGraphicsTextItem* m_titleItem; | ||
AxisItem* m_axisXItem; | ||||
QList<AxisItem*> m_axisYItem; | ||||
Michal Klocek
|
r53 | QRect m_rect; | ||
Tero Ahola
|
r103 | QList<QChartSeries *> m_chartSeries; | ||
QList<ChartItemControl *> m_chartItemControls; | ||||
Michal Klocek
|
r67 | QVector<PlotDomain> m_plotDomainList; | ||
Michal Klocek
|
r53 | int m_plotDataIndex; | ||
int m_marginSize; | ||||
Tero Ahola
|
r103 | ChartTheme *m_chartTheme; | ||
Michal Klocek
|
r12 | }; | ||
Tero Ahola
|
r30 | QTCOMMERCIALCHART_END_NAMESPACE | ||
Michal Klocek
|
r12 | |||
#endif | ||||