@@ -0,0 +1,22 | |||
|
1 | #ifndef CHARTITEM_H_ | |
|
2 | #define CHARTITEM_H_ | |
|
3 | ||
|
4 | #include "plotdomain_p.h" | |
|
5 | #include "chartobjectinterface_p.h" | |
|
6 | #include <QGraphicsItem> | |
|
7 | ||
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
|
9 | ||
|
10 | class ChartItem : public QGraphicsItem, public ChartObjectInterface | |
|
11 | { | |
|
12 | enum ChartItemTypes{ AXIS_ITEM = UserType+1, XYLINE_ITEM}; | |
|
13 | public: | |
|
14 | ChartItem(QGraphicsItem* parent = 0):QGraphicsItem(parent){}; | |
|
15 | virtual ~ChartItem(){}; | |
|
16 | // TODO: this is a hack; integration ongoing: | |
|
17 | QGraphicsItem *graphicsItem() { return this; } | |
|
18 | }; | |
|
19 | ||
|
20 | QTCOMMERCIALCHART_END_NAMESPACE | |
|
21 | ||
|
22 | #endif /* CHARTITEM_H_ */ |
@@ -7,7 +7,7 | |||
|
7 | 7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | 8 | |
|
9 | 9 | AxisItem::AxisItem(AxisType type,QGraphicsItem* parent) : |
|
10 |
|
|
|
10 | ChartItem(parent), | |
|
11 | 11 | m_ticks(4), |
|
12 | 12 | m_type(type) |
|
13 | 13 | { |
@@ -43,12 +43,7 void AxisItem::setPlotDomain(const PlotDomain& plotDomain) | |||
|
43 | 43 | createItems(); |
|
44 | 44 | } |
|
45 | 45 | |
|
46 |
void AxisItem::set |
|
|
47 | { | |
|
48 | QGraphicsItem::setPos(pos); | |
|
49 | } | |
|
50 | ||
|
51 | void AxisItem::resize(const QSize &size) | |
|
46 | void AxisItem::setSize(const QSize &size) | |
|
52 | 47 | { |
|
53 | 48 | m_rect = QRectF(QPoint(0,0),size); |
|
54 | 49 | createItems(); |
@@ -2,12 +2,12 | |||
|
2 | 2 | #define AXISITEM_H_ |
|
3 | 3 | |
|
4 | 4 | #include "plotdomain_p.h" |
|
5 |
#include "chartitem |
|
|
5 | #include "chartitem_p.h" | |
|
6 | 6 | #include <QGraphicsItem> |
|
7 | 7 | |
|
8 | 8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
9 | 9 | |
|
10 |
class AxisItem: public |
|
|
10 | class AxisItem : public ChartItem | |
|
11 | 11 | { |
|
12 | 12 | public: |
|
13 | 13 | enum AxisType{X_AXIS,Y_AXIS}; |
@@ -19,9 +19,8 public: | |||
|
19 | 19 | QRectF boundingRect() const; |
|
20 | 20 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){}; |
|
21 | 21 | |
|
22 |
public: // from Chart |
|
|
23 |
void set |
|
|
24 | void resize(const QSize &size); | |
|
22 | public: // from ChartObjectInterface | |
|
23 | void setSize(const QSize &size); | |
|
25 | 24 | void setTheme(ChartTheme *theme); |
|
26 | 25 | void setPlotDomain(const PlotDomain& data); |
|
27 | 26 |
@@ -5,16 +5,11 | |||
|
5 | 5 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
6 | 6 | |
|
7 | 7 | Bar::Bar(QGraphicsItem *parent) |
|
8 |
: |
|
|
8 | : ChartItem(parent) | |
|
9 | 9 | { |
|
10 | 10 | } |
|
11 | 11 | |
|
12 |
void Bar::set |
|
|
13 | { | |
|
14 | QGraphicsItem::setPos(pos); | |
|
15 | } | |
|
16 | ||
|
17 | void Bar::resize(const QSize& size) | |
|
12 | void Bar::setSize(const QSize& size) | |
|
18 | 13 | { |
|
19 | 14 | mWidth = size.width(); |
|
20 | 15 | mHeight = size.height(); |
@@ -1,21 +1,20 | |||
|
1 | 1 | #ifndef BAR_H |
|
2 | 2 | #define BAR_H |
|
3 | 3 | |
|
4 |
#include "chartitem |
|
|
4 | #include "chartitem_p.h" | |
|
5 | 5 | #include "qchartglobal.h" |
|
6 | 6 | #include <QGraphicsItem> |
|
7 | 7 | |
|
8 | 8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
9 | 9 | |
|
10 | 10 | // Single bar item of chart |
|
11 |
class Bar : public |
|
|
11 | class Bar : public ChartItem | |
|
12 | 12 | { |
|
13 | 13 | public: |
|
14 | 14 | Bar(QGraphicsItem *parent=0); |
|
15 | 15 | |
|
16 | 16 | public: // from ChartItemControl |
|
17 |
void set |
|
|
18 | void resize(const QSize &size); | |
|
17 | void setSize(const QSize &size); | |
|
19 | 18 | void setTheme(ChartTheme *theme); |
|
20 | 19 | void setPlotDomain(const PlotDomain& data); |
|
21 | 20 |
@@ -5,7 +5,7 | |||
|
5 | 5 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
6 | 6 | |
|
7 | 7 | BarGroup::BarGroup(BarChartSeries& series, QGraphicsItem *parent) : |
|
8 |
|
|
|
8 | ChartItem(parent) | |
|
9 | 9 | ,mSeries(series) |
|
10 | 10 | ,mLayoutSet(false) |
|
11 | 11 | ,mLayoutDirty(true) |
@@ -14,12 +14,7 BarGroup::BarGroup(BarChartSeries& series, QGraphicsItem *parent) : | |||
|
14 | 14 | dataChanged(); |
|
15 | 15 | } |
|
16 | 16 | |
|
17 |
void BarGroup::set |
|
|
18 | { | |
|
19 | QGraphicsItem::setPos(pos); | |
|
20 | } | |
|
21 | ||
|
22 | void BarGroup::resize(const QSize& size) | |
|
17 | void BarGroup::setSize(const QSize& size) | |
|
23 | 18 | { |
|
24 | 19 | qDebug() << "BarGroup::setSize"; |
|
25 | 20 | mWidth = size.width(); |
@@ -1,21 +1,20 | |||
|
1 | 1 | #ifndef QBARGROUP_H |
|
2 | 2 | #define QBARGROUP_H |
|
3 | 3 | |
|
4 |
#include "chartitem |
|
|
4 | #include "chartitem_p.h" | |
|
5 | 5 | #include "bar.h" |
|
6 | 6 | #include "barchartseries.h" |
|
7 | 7 | #include <QGraphicsItem> |
|
8 | 8 | |
|
9 | 9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
10 | 10 | |
|
11 |
class BarGroup : public |
|
|
11 | class BarGroup : public ChartItem | |
|
12 | 12 | { |
|
13 | 13 | public: |
|
14 | 14 | explicit BarGroup(BarChartSeries& series, QGraphicsItem *parent = 0); |
|
15 | 15 | |
|
16 |
public: // from Chart |
|
|
17 |
void set |
|
|
18 | void resize(const QSize &size); | |
|
16 | public: // from ChartObjectInterface | |
|
17 | void setSize(const QSize &size); | |
|
19 | 18 | void setTheme(ChartTheme *theme); |
|
20 | 19 | void setPlotDomain(const PlotDomain& data); |
|
21 | 20 |
@@ -7,7 +7,7 | |||
|
7 | 7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | 8 | |
|
9 | 9 | StackedBarGroup::StackedBarGroup(StackedBarChartSeries& series, QGraphicsItem *parent) : |
|
10 |
|
|
|
10 | ChartItem(parent) | |
|
11 | 11 | ,mSeries(series) |
|
12 | 12 | ,mLayoutSet(false) |
|
13 | 13 | ,mLayoutDirty(true) |
@@ -16,16 +16,9 StackedBarGroup::StackedBarGroup(StackedBarChartSeries& series, QGraphicsItem *p | |||
|
16 | 16 | dataChanged(); |
|
17 | 17 | } |
|
18 | 18 | |
|
19 | ||
|
20 | void StackedBarGroup::setPos(const QPointF & pos) | |
|
21 | { | |
|
22 | qDebug() << "StackedBarGroup::setPos"; | |
|
23 | // TODO: | |
|
24 | } | |
|
25 | ||
|
26 | void StackedBarGroup::resize(const QSize& size) | |
|
19 | void StackedBarGroup::setSize(const QSize& size) | |
|
27 | 20 | { |
|
28 |
qDebug() << "StackedBarGroup:: |
|
|
21 | qDebug() << "StackedBarGroup::setSize"; | |
|
29 | 22 | mWidth = size.width(); |
|
30 | 23 | mHeight = size.height(); |
|
31 | 24 | layoutChanged(); |
@@ -1,21 +1,20 | |||
|
1 | 1 | #ifndef PERCENTBARGROUP_H |
|
2 | 2 | #define PERCENTBARGROUP_H |
|
3 | 3 | |
|
4 |
#include "chartitem |
|
|
4 | #include "chartitem_p.h" | |
|
5 | 5 | #include "bar.h" |
|
6 | 6 | #include "percentbarchartseries.h" |
|
7 | 7 | #include <QGraphicsItem> |
|
8 | 8 | |
|
9 | 9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
10 | 10 | |
|
11 |
class PercentBarGroup : public |
|
|
11 | class PercentBarGroup : public ChartItem | |
|
12 | 12 | { |
|
13 | 13 | public: |
|
14 | 14 | PercentBarGroup(PercentBarChartSeries& series, QGraphicsItem *parent = 0); |
|
15 | 15 | |
|
16 |
public: // From Chart |
|
|
17 |
void set |
|
|
18 | void resize(const QSize &size); | |
|
16 | public: // From ChartObjectInterface | |
|
17 | void setSize(const QSize &size); | |
|
19 | 18 | void setTheme(ChartTheme *theme); |
|
20 | 19 | void setPlotDomain(const PlotDomain& data); |
|
21 | 20 |
@@ -5,7 +5,7 | |||
|
5 | 5 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
6 | 6 | |
|
7 | 7 | PercentBarGroup::PercentBarGroup(PercentBarChartSeries& series, QGraphicsItem *parent) : |
|
8 |
|
|
|
8 | ChartItem(parent) | |
|
9 | 9 | ,mSeries(series) |
|
10 | 10 | ,mLayoutSet(false) |
|
11 | 11 | ,mLayoutDirty(true) |
@@ -14,15 +14,9 PercentBarGroup::PercentBarGroup(PercentBarChartSeries& series, QGraphicsItem *p | |||
|
14 | 14 | dataChanged(); |
|
15 | 15 | } |
|
16 | 16 | |
|
17 |
void PercentBarGroup::set |
|
|
17 | void PercentBarGroup::setSize(const QSize& size) | |
|
18 | 18 | { |
|
19 |
qDebug() << "PercentBarGroup::set |
|
|
20 | // TODO: | |
|
21 | } | |
|
22 | ||
|
23 | void PercentBarGroup::resize(const QSize& size) | |
|
24 | { | |
|
25 | qDebug() << "PercentBarGroup::resize"; | |
|
19 | qDebug() << "PercentBarGroup::setSize"; | |
|
26 | 20 | mWidth = size.width(); |
|
27 | 21 | mHeight = size.height(); |
|
28 | 22 | layoutChanged(); |
@@ -1,21 +1,20 | |||
|
1 | 1 | #ifndef STACKEDBARGROUP_H |
|
2 | 2 | #define STACKEDBARGROUP_H |
|
3 | 3 | |
|
4 |
#include "chartitem |
|
|
4 | #include "chartitem_p.h" | |
|
5 | 5 | #include "bar.h" |
|
6 | 6 | #include "stackedbarchartseries.h" |
|
7 | 7 | #include <QGraphicsItem> |
|
8 | 8 | |
|
9 | 9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
10 | 10 | |
|
11 |
class StackedBarGroup : public |
|
|
11 | class StackedBarGroup : public ChartItem | |
|
12 | 12 | { |
|
13 | 13 | public: |
|
14 | 14 | StackedBarGroup(StackedBarChartSeries& series, QGraphicsItem *parent = 0); |
|
15 | 15 | |
|
16 |
public: // From Chart |
|
|
17 |
void set |
|
|
18 | void resize(const QSize &size); | |
|
16 | public: // From ChartObjectInterface | |
|
17 | void setSize(const QSize &size); | |
|
19 | 18 | void setTheme(ChartTheme *theme); |
|
20 | 19 | void setPlotDomain(const PlotDomain& data); |
|
21 | 20 |
@@ -1,24 +1,30 | |||
|
1 |
#ifndef CHART |
|
|
2 |
#define CHART |
|
|
1 | #ifndef CHART_OBJECT_INTERFACE_H | |
|
2 | #define CHART_OBJECT_INTERFACE_H | |
|
3 | 3 | |
|
4 | 4 | #include "plotdomain_p.h" |
|
5 | 5 | #include <qchartglobal.h> |
|
6 | 6 | #include <QSize> |
|
7 | 7 | |
|
8 | class QGraphicsItem; | |
|
9 | ||
|
8 | 10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
9 | 11 | |
|
10 | 12 | class ChartTheme; |
|
11 | 13 | class PlotDomain; |
|
12 | 14 | |
|
13 | class ChartItemControl | |
|
15 | /*! | |
|
16 | * Internal abstract interface for passing updates on chart related properties. | |
|
17 | */ | |
|
18 | class ChartObjectInterface | |
|
14 | 19 | { |
|
15 | 20 | public: |
|
16 |
virtual void set |
|
|
17 | virtual void resize(const QSize &size) = 0; | |
|
21 | virtual void setSize(const QSize &size) = 0; | |
|
18 | 22 | virtual void setTheme(ChartTheme *theme) = 0; |
|
19 | 23 | virtual void setPlotDomain(const PlotDomain& data) = 0; |
|
24 | // TODO: this is a hack; integration ongoing: | |
|
25 | virtual QGraphicsItem *graphicsItem() { return 0; } | |
|
20 | 26 | }; |
|
21 | 27 | |
|
22 | 28 | QTCOMMERCIALCHART_END_NAMESPACE |
|
23 | 29 | |
|
24 |
#endif // CHART |
|
|
30 | #endif // CHART_OBJECT_INTERFACE_H |
@@ -13,7 +13,7 | |||
|
13 | 13 | #include "percentbarchartseries.h" |
|
14 | 14 | #include "percentbargroup.h" |
|
15 | 15 | #include "charttheme_p.h" |
|
16 |
#include "chart |
|
|
16 | #include "chartobjectinterface_p.h" | |
|
17 | 17 | |
|
18 | 18 | #include "xylinechartitem_p.h" |
|
19 | 19 | #include "plotdomain_p.h" |
@@ -37,8 +37,8 QChart::QChart(QGraphicsObject* parent) : QGraphicsObject(parent), | |||
|
37 | 37 | PlotDomain domain; |
|
38 | 38 | m_plotDomainList << domain; |
|
39 | 39 | m_axisYItem << new AxisItem(AxisItem::Y_AXIS,this); |
|
40 |
m_chart |
|
|
41 |
m_chart |
|
|
40 | m_chartObjectInterfaces << m_axisXItem; | |
|
41 | m_chartObjectInterfaces << m_axisYItem.at(0); | |
|
42 | 42 | } |
|
43 | 43 | |
|
44 | 44 | QChart::~QChart(){} |
@@ -76,11 +76,11 void QChart::addSeries(QChartSeries* series) | |||
|
76 | 76 | |
|
77 | 77 | XYLineChartItem* item = new XYLineChartItem(xyseries,this); |
|
78 | 78 | |
|
79 |
// TODO: combine Chart |
|
|
80 |
m_chart |
|
|
79 | // TODO: combine ChartObjectInterface and ChartItem apis | |
|
80 | m_chartObjectInterfaces << item; | |
|
81 | 81 | item->setTheme(m_chartTheme); |
|
82 | 82 | |
|
83 |
foreach(Chart |
|
|
83 | foreach(ChartObjectInterface* i, m_chartObjectInterfaces) | |
|
84 | 84 | i->setPlotDomain(m_plotDomainList.at(m_plotDataIndex)); |
|
85 | 85 | |
|
86 | 86 | break; |
@@ -98,7 +98,7 void QChart::addSeries(QChartSeries* series) | |||
|
98 | 98 | barGroup->addColor(QColor(0,0,255,128)); |
|
99 | 99 | barGroup->addColor(QColor(255,128,0,128)); |
|
100 | 100 | |
|
101 |
m_chart |
|
|
101 | m_chartObjectInterfaces << barGroup; | |
|
102 | 102 | childItems().append(barGroup); |
|
103 | 103 | break; |
|
104 | 104 | } |
@@ -115,7 +115,7 void QChart::addSeries(QChartSeries* series) | |||
|
115 | 115 | stackedBarGroup->addColor(QColor(0,0,255,128)); |
|
116 | 116 | stackedBarGroup->addColor(QColor(255,128,0,128)); |
|
117 | 117 | |
|
118 |
m_chart |
|
|
118 | m_chartObjectInterfaces << stackedBarGroup; | |
|
119 | 119 | childItems().append(stackedBarGroup); |
|
120 | 120 | break; |
|
121 | 121 | } |
@@ -132,7 +132,7 void QChart::addSeries(QChartSeries* series) | |||
|
132 | 132 | percentBarGroup->addColor(QColor(0,0,255,128)); |
|
133 | 133 | percentBarGroup->addColor(QColor(255,128,0,128)); |
|
134 | 134 | |
|
135 |
m_chart |
|
|
135 | m_chartObjectInterfaces << percentBarGroup; | |
|
136 | 136 | childItems().append(percentBarGroup); |
|
137 | 137 | break; |
|
138 | 138 | } |
@@ -140,7 +140,7 void QChart::addSeries(QChartSeries* series) | |||
|
140 | 140 | QScatterSeries *scatterSeries = qobject_cast<QScatterSeries *>(series); |
|
141 | 141 | scatterSeries->d->m_theme = m_chartTheme->themeForSeries(); |
|
142 | 142 | scatterSeries->d->setParentItem(this); |
|
143 |
m_chart |
|
|
143 | m_chartObjectInterfaces << scatterSeries->d; | |
|
144 | 144 | //TODO:? scatterSeries->d->m_themeIndex = m_chartSeries.count() - 1; |
|
145 | 145 | break; |
|
146 | 146 | } |
@@ -151,7 +151,7 void QChart::addSeries(QChartSeries* series) | |||
|
151 | 151 | // pieSeries->setSliceColor(i, nextColor()); |
|
152 | 152 | // } |
|
153 | 153 | pieSeries->d->setTheme(m_chartTheme); |
|
154 |
m_chart |
|
|
154 | m_chartObjectInterfaces << pieSeries->d; | |
|
155 | 155 | |
|
156 | 156 | // Set pre-defined colors in case the series has no colors defined |
|
157 | 157 | // TODO: how to define the color for all the slices of a pie? |
@@ -206,11 +206,10 void QChart::setSize(const QSize& size) | |||
|
206 | 206 | m_rect = QRect(QPoint(0,0),size); |
|
207 | 207 | QRect rect = m_rect.adjusted(margin(),margin(), -margin(), -margin()); |
|
208 | 208 | |
|
209 | //recaculate title | |
|
209 | // recalculate title position | |
|
210 | 210 | if(m_titleItem){ |
|
211 | 211 | QPointF center = m_rect.center() -m_titleItem->boundingRect().center(); |
|
212 | 212 | m_titleItem->setPos(center.x(),m_rect.top()/2 + margin()/2); |
|
213 | ||
|
214 | 213 | } |
|
215 | 214 | |
|
216 | 215 | //recalculate background gradient |
@@ -223,9 +222,12 void QChart::setSize(const QSize& size) | |||
|
223 | 222 | m_backgroundItem->setBrush(m_backgroundGradient); |
|
224 | 223 | } |
|
225 | 224 | |
|
226 | foreach (ChartItemControl *ctrl, m_chartItemControls) { | |
|
227 | ctrl->setPos(rect.topLeft()); | |
|
228 | ctrl->resize(rect.size()); | |
|
225 | // resize and reposition childs | |
|
226 | foreach (ChartObjectInterface *ctrl, m_chartObjectInterfaces) { | |
|
227 | QGraphicsItem *item = ctrl->graphicsItem(); | |
|
228 | if (item) | |
|
229 | item->setPos(rect.topLeft()); | |
|
230 | ctrl->setSize(rect.size()); | |
|
229 | 231 | } |
|
230 | 232 | |
|
231 | 233 | update(); |
@@ -279,7 +281,7 void QChart::setTheme(QChart::ChartThemeId theme) | |||
|
279 | 281 | setBackground(m_chartTheme->d->m_gradientStartColor, |
|
280 | 282 | m_chartTheme->d->m_gradientEndColor, |
|
281 | 283 | m_bacgroundOrinetation); |
|
282 |
foreach (Chart |
|
|
284 | foreach (ChartObjectInterface *ctrl, m_chartObjectInterfaces) | |
|
283 | 285 | ctrl->setTheme(m_chartTheme); |
|
284 | 286 | update(); |
|
285 | 287 | } |
@@ -303,7 +305,7 void QChart::zoomInToRect(const QRect& rectangle) | |||
|
303 | 305 | m_plotDomainList<<domain; |
|
304 | 306 | m_plotDataIndex++; |
|
305 | 307 | |
|
306 |
foreach (Chart |
|
|
308 | foreach (ChartObjectInterface* ctrl, m_chartObjectInterfaces) | |
|
307 | 309 | ctrl->setPlotDomain(m_plotDomainList[m_plotDataIndex]); |
|
308 | 310 | update(); |
|
309 | 311 | } |
@@ -312,7 +314,7 void QChart::zoomIn() | |||
|
312 | 314 | { |
|
313 | 315 | if (m_plotDataIndex < m_plotDomainList.count() - 1) { |
|
314 | 316 | m_plotDataIndex++; |
|
315 |
foreach (Chart |
|
|
317 | foreach (ChartObjectInterface* item, m_chartObjectInterfaces) | |
|
316 | 318 | item->setPlotDomain(m_plotDomainList[m_plotDataIndex]); |
|
317 | 319 | update(); |
|
318 | 320 | } else { |
@@ -328,7 +330,7 void QChart::zoomOut() | |||
|
328 | 330 | { |
|
329 | 331 | if (m_plotDataIndex > 0) { |
|
330 | 332 | m_plotDataIndex--; |
|
331 |
foreach (Chart |
|
|
333 | foreach (ChartObjectInterface* item, m_chartObjectInterfaces) | |
|
332 | 334 | item->setPlotDomain(m_plotDomainList[m_plotDataIndex]); |
|
333 | 335 | update(); |
|
334 | 336 | } |
@@ -338,7 +340,7 void QChart::zoomReset() | |||
|
338 | 340 | { |
|
339 | 341 | if (m_plotDataIndex > 0) { |
|
340 | 342 | m_plotDataIndex = 0; |
|
341 |
foreach (Chart |
|
|
343 | foreach (ChartObjectInterface* item, m_chartObjectInterfaces) | |
|
342 | 344 | item->setPlotDomain(m_plotDomainList[m_plotDataIndex]); |
|
343 | 345 | update(); |
|
344 | 346 | } |
@@ -15,7 +15,7 class PlotDomain; | |||
|
15 | 15 | class BarGroup; |
|
16 | 16 | class QChartAxis; |
|
17 | 17 | class ChartTheme; |
|
18 |
class Chart |
|
|
18 | class ChartObjectInterface; | |
|
19 | 19 | |
|
20 | 20 | // TODO: We don't need to have QChart tied to QGraphicsItem: |
|
21 | 21 | //class QTCOMMERCIALCHART_EXPORT QChart |
@@ -87,7 +87,7 private: | |||
|
87 | 87 | QList<AxisItem*> m_axisYItem; |
|
88 | 88 | QRect m_rect; |
|
89 | 89 | QList<QChartSeries *> m_chartSeries; |
|
90 |
QList<Chart |
|
|
90 | QList<ChartObjectInterface *> m_chartObjectInterfaces; | |
|
91 | 91 | QVector<PlotDomain> m_plotDomainList; |
|
92 | 92 | int m_plotDataIndex; |
|
93 | 93 | int m_marginSize; |
@@ -47,12 +47,7 bool QPieSeriesPrivate::setData(QList<qreal> data) | |||
|
47 | 47 | return true; |
|
48 | 48 | } |
|
49 | 49 | |
|
50 |
void QPieSeriesPrivate::set |
|
|
51 | { | |
|
52 | // TODO | |
|
53 | } | |
|
54 | ||
|
55 | void QPieSeriesPrivate::resize(const QSize &size) | |
|
50 | void QPieSeriesPrivate::setSize(const QSize &size) | |
|
56 | 51 | { |
|
57 | 52 | // TODO: allow user setting the size? |
|
58 | 53 | // TODO: allow user defining the margins? |
@@ -1,7 +1,7 | |||
|
1 | 1 | #ifndef PIESERIESPRIVATE_H |
|
2 | 2 | #define PIESERIESPRIVATE_H |
|
3 | 3 | |
|
4 |
#include "chart |
|
|
4 | #include "chartobjectinterface_p.h" | |
|
5 | 5 | #include "qpieseries.h" |
|
6 | 6 | #include <QRectF> |
|
7 | 7 | #include <QColor> |
@@ -10,16 +10,15 class QGraphicsItem; | |||
|
10 | 10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
11 | 11 | class PieSlice; |
|
12 | 12 | |
|
13 |
class QPieSeriesPrivate : public Chart |
|
|
13 | class QPieSeriesPrivate : public ChartObjectInterface | |
|
14 | 14 | { |
|
15 | 15 | public: |
|
16 | 16 | // TODO: use a generic data class instead of x and y |
|
17 | 17 | QPieSeriesPrivate(); |
|
18 | 18 | ~QPieSeriesPrivate(); |
|
19 | 19 | |
|
20 |
public: // from Chart |
|
|
21 |
void set |
|
|
22 | void resize(const QSize &size); | |
|
20 | public: // from ChartObjectInterface | |
|
21 | void setSize(const QSize &size); | |
|
23 | 22 | void setTheme(ChartTheme *theme); |
|
24 | 23 | void setPlotDomain(const PlotDomain& data); |
|
25 | 24 |
@@ -10,7 +10,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
10 | 10 | //#define QSeriesData QList<qreal> |
|
11 | 11 | |
|
12 | 12 | QScatterSeriesPrivate::QScatterSeriesPrivate(QGraphicsItem *parent) : |
|
13 |
|
|
|
13 | ChartItem(parent), | |
|
14 | 14 | m_scalex(100), // TODO: let the use define the scale (or autoscaled) |
|
15 | 15 | m_scaley(100), |
|
16 | 16 | m_markerColor(QColor()) |
@@ -29,8 +29,22 void QScatterSeriesPrivate::resize(QRectF rect) | |||
|
29 | 29 | m_sceney.append(rect.bottom() - y * (rect.height() / m_scaley)); |
|
30 | 30 | } |
|
31 | 31 | |
|
32 | // TODO: | |
|
33 | //void QScatterSeriesPrivate::setAxisScale(qreal xscale, qreal yscale) | |
|
32 | void QScatterSeriesPrivate::setSize(const QSize &size) | |
|
33 | { | |
|
34 | QGraphicsItem *parent = this->parentItem(); | |
|
35 | if (parent) | |
|
36 | resize(QRectF(parent->pos(), size)); | |
|
37 | } | |
|
38 | ||
|
39 | void QScatterSeriesPrivate::setTheme(ChartTheme *theme) | |
|
40 | { | |
|
41 | m_theme = theme->themeForSeries(); | |
|
42 | } | |
|
43 | ||
|
44 | void QScatterSeriesPrivate::setPlotDomain(const PlotDomain& plotDomain) | |
|
45 | { | |
|
46 | // TODO | |
|
47 | } | |
|
34 | 48 | |
|
35 | 49 | QRectF QScatterSeriesPrivate::boundingRect() const |
|
36 | 50 | { |
@@ -62,26 +76,6 void QScatterSeriesPrivate::paint(QPainter *painter, const QStyleOptionGraphicsI | |||
|
62 | 76 | } |
|
63 | 77 | } |
|
64 | 78 | |
|
65 | void QScatterSeriesPrivate::setPos(const QPointF & pos) | |
|
66 | { | |
|
67 | // TODO | |
|
68 | } | |
|
69 | ||
|
70 | void QScatterSeriesPrivate::resize(const QSize &size) | |
|
71 | { | |
|
72 | resize(QRect(0, 0, size.width(), size.height())); | |
|
73 | } | |
|
74 | ||
|
75 | void QScatterSeriesPrivate::setTheme(ChartTheme *theme) | |
|
76 | { | |
|
77 | m_theme = theme->themeForSeries(); | |
|
78 | } | |
|
79 | ||
|
80 | void QScatterSeriesPrivate::setPlotDomain(const PlotDomain& plotDomain) | |
|
81 | { | |
|
82 | // TODO | |
|
83 | } | |
|
84 | ||
|
85 | 79 | QScatterSeries::QScatterSeries(QObject *parent) : |
|
86 | 80 | QChartSeries(parent), |
|
87 | 81 | d(new QScatterSeriesPrivate(qobject_cast<QGraphicsItem *> (parent))) |
@@ -95,6 +89,8 bool QScatterSeries::setData(QList<qreal> x, QList<qreal> y) | |||
|
95 | 89 | d->m_y = y; |
|
96 | 90 | QGraphicsItem *parentItem = qobject_cast<QGraphicsItem *>(parent()); |
|
97 | 91 | Q_ASSERT(parentItem); |
|
92 | // d->setPos(parentItem->pos()); | |
|
93 | // d->setSize(parentItem->boundingRect().size().toSize()); | |
|
98 | 94 | d->resize(parentItem->boundingRect()); |
|
99 | 95 | return true; |
|
100 | 96 | } |
@@ -3,7 +3,7 | |||
|
3 | 3 | |
|
4 | 4 | #include "qchartseries.h" |
|
5 | 5 | #include "charttheme_p.h" |
|
6 |
#include "chartitem |
|
|
6 | #include "chartitem_p.h" | |
|
7 | 7 | #include <QGraphicsItem> |
|
8 | 8 | |
|
9 | 9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
@@ -11,23 +11,23 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
11 | 11 | /*! |
|
12 | 12 | * The PIMPL class of QScatterSeries. |
|
13 | 13 | */ |
|
14 |
class QScatterSeriesPrivate : public |
|
|
14 | class QScatterSeriesPrivate : public ChartItem | |
|
15 | 15 | { |
|
16 | 16 | public: |
|
17 | 17 | QScatterSeriesPrivate(QGraphicsItem *parent); |
|
18 | 18 | |
|
19 | public: // from ChartObjectInterface | |
|
20 | void setSize(const QSize &size); | |
|
21 | void setTheme(ChartTheme *theme); | |
|
22 | void setPlotDomain(const PlotDomain& data); | |
|
23 | ||
|
19 | 24 | public: // from QGraphicsItem |
|
20 | void setPos(const QPointF & pos); | |
|
21 | void resize(QRectF rect); | |
|
22 | 25 | QRectF boundingRect() const; |
|
23 | 26 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
24 | 27 | |
|
25 | public: // from ChartItemControl | |
|
26 | void resize(const QSize &size); | |
|
27 | void setTheme(ChartTheme *theme); | |
|
28 | void setPlotDomain(const PlotDomain& data); | |
|
29 | ||
|
30 | 28 | public: |
|
29 | void resize(QRectF rect); // TODO: replace with setSize | |
|
30 | ||
|
31 | 31 | // TODO: use the chart data class instead of list of x and y values? |
|
32 | 32 | QList<qreal> m_x; |
|
33 | 33 | QList<qreal> m_y; |
@@ -40,6 +40,7 PRIVATE_HEADERS += \ | |||
|
40 | 40 | qpieseries_p.h \ |
|
41 | 41 | pieslice.h \ |
|
42 | 42 | axisitem_p.h \ |
|
43 | chartitem_p.h \ | |
|
43 | 44 | charttheme_p.h |
|
44 | 45 | |
|
45 | 46 | PUBLIC_HEADERS += \ |
@@ -60,7 +61,7 PUBLIC_HEADERS += \ | |||
|
60 | 61 | qchartaxis.h |
|
61 | 62 | |
|
62 | 63 | HEADERS += $$PUBLIC_HEADERS \ |
|
63 |
chart |
|
|
64 | chartobjectinterface_p.h | |
|
64 | 65 | HEADERS += $$PRIVATE_HEADERS |
|
65 | 66 | |
|
66 | 67 | INCLUDEPATH += xylinechart \ |
@@ -108,3 +109,5 win32:QMAKE_DISTCLEAN += /Q $$CHART_BUILD_HEADER_DIR $$CHART_BUILD_LIB_DIR | |||
|
108 | 109 | |
|
109 | 110 | |
|
110 | 111 | |
|
112 | ||
|
113 |
@@ -8,19 +8,14 | |||
|
8 | 8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
9 | 9 | |
|
10 | 10 | XYLineChartItem::XYLineChartItem(QXYChartSeries* series,QGraphicsItem *parent) : |
|
11 |
|
|
|
11 | ChartItem(parent), | |
|
12 | 12 | m_series(series), |
|
13 | 13 | m_pathItem(new QGraphicsPathItem(this)) |
|
14 | 14 | { |
|
15 | 15 | setFlags(QGraphicsItem::ItemClipsChildrenToShape); |
|
16 | 16 | } |
|
17 | 17 | |
|
18 |
void XYLineChartItem::set |
|
|
19 | { | |
|
20 | QGraphicsItem::setPos(pos); | |
|
21 | } | |
|
22 | ||
|
23 | void XYLineChartItem::resize(const QSize &size) | |
|
18 | void XYLineChartItem::setSize(const QSize &size) | |
|
24 | 19 | { |
|
25 | 20 | m_rect = QRect(0, 0, size.width(), size.height()); |
|
26 | 21 | prepareGeometryChange(); |
@@ -2,7 +2,7 | |||
|
2 | 2 | #define XYLINECHARTITEM_H |
|
3 | 3 | |
|
4 | 4 | #include "qchartglobal.h" |
|
5 |
#include "chartitem |
|
|
5 | #include "chartitem_p.h" | |
|
6 | 6 | #include "charttheme_p.h" |
|
7 | 7 | #include <QGraphicsItem> |
|
8 | 8 | |
@@ -10,7 +10,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
10 | 10 | |
|
11 | 11 | class QXYChartSeries; |
|
12 | 12 | |
|
13 |
class XYLineChartItem : public |
|
|
13 | class XYLineChartItem : public ChartItem | |
|
14 | 14 | { |
|
15 | 15 | |
|
16 | 16 | public: |
@@ -22,9 +22,8 public: | |||
|
22 | 22 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){}; |
|
23 | 23 | // virtual QPainterPath shape() const; |
|
24 | 24 | |
|
25 |
public: // from Chart |
|
|
26 |
void set |
|
|
27 | void resize(const QSize &size); | |
|
25 | public: // from ChartObjectInterface | |
|
26 | void setSize(const QSize &size); | |
|
28 | 27 | void setTheme(ChartTheme *theme); |
|
29 | 28 | void setPlotDomain(const PlotDomain& data); |
|
30 | 29 |
General Comments 0
You need to be logged in to leave comments.
Login now