##// END OF EJS Templates
adopted theme interface to barcharts
sauimone -
r106:bc1381ca9ce2
parent child
Show More
@@ -32,7 +32,8 void BarGroup::setPlotDomain(const PlotDomain& data)
32
32
33 void BarGroup::setTheme(ChartTheme *theme)
33 void BarGroup::setTheme(ChartTheme *theme)
34 {
34 {
35 // TODO
35 qDebug() << "BarGroup::setTheme";
36 // TODO:
36 }
37 }
37
38
38 void BarGroup::setBarWidth( int w )
39 void BarGroup::setBarWidth( int w )
@@ -30,6 +30,12 void PercentBarGroup::setPlotDomain(const PlotDomain& data)
30 // TODO:
30 // TODO:
31 }
31 }
32
32
33 void PercentBarGroup::setTheme(ChartTheme *theme)
34 {
35 qDebug() << "PercentBarGroup::setTheme";
36 // TODO:
37 }
38
33 void PercentBarGroup::setBarWidth( int w )
39 void PercentBarGroup::setBarWidth( int w )
34 {
40 {
35 mBarDefaultWidth = w;
41 mBarDefaultWidth = w;
@@ -30,6 +30,12 void StackedBarGroup::setPlotDomain(const PlotDomain& data)
30 // TODO:
30 // TODO:
31 }
31 }
32
32
33 void StackedBarGroup::setTheme(ChartTheme *theme)
34 {
35 qDebug() << "StackedBarGroup::setTheme";
36 // TODO:
37 }
38
33 void StackedBarGroup::setBarWidth( int w )
39 void StackedBarGroup::setBarWidth( int w )
34 {
40 {
35 mBarDefaultWidth = w;
41 mBarDefaultWidth = w;
@@ -8,6 +8,7
8
8
9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10
10
11 // TODO: derive this from ChartObjectInterface, when setSize is back in ChartItem
11 class StackedBarGroup : public ChartItem
12 class StackedBarGroup : public ChartItem
12 {
13 {
13 public:
14 public:
@@ -6,7 +6,8
6 #include <QGraphicsItem>
6 #include <QGraphicsItem>
7
7
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9
9 // TODO: setSize and set plotDomain back here. Derive this only from QGraphicsItem
10 // class ChartItem : public QGraphicsItem
10 class ChartItem : public QGraphicsItem, public ChartObjectInterface
11 class ChartItem : public QGraphicsItem, public ChartObjectInterface
11 {
12 {
12 enum ChartItemTypes{ AXIS_ITEM = UserType+1, XYLINE_ITEM};
13 enum ChartItemTypes{ AXIS_ITEM = UserType+1, XYLINE_ITEM};
@@ -18,6 +18,7 class PlotDomain;
18 class ChartObjectInterface
18 class ChartObjectInterface
19 {
19 {
20 public:
20 public:
21 // TODO: move setSize and setPlotDomain back to ChartItem. This interface should be only about handling themes.
21 virtual void setSize(const QSize &size) = 0;
22 virtual void setSize(const QSize &size) = 0;
22 virtual void setTheme(ChartTheme *theme) = 0;
23 virtual void setTheme(ChartTheme *theme) = 0;
23 virtual void setPlotDomain(const PlotDomain& data) = 0;
24 virtual void setPlotDomain(const PlotDomain& data) = 0;
@@ -100,14 +100,14 void QChart::addSeries(QChartSeries* series)
100
100
101 m_chartObjectInterfaces << barGroup;
101 m_chartObjectInterfaces << barGroup;
102 childItems().append(barGroup);
102 childItems().append(barGroup);
103
103 /*
104 m_plotDataIndex = 0 ;
104 m_plotDataIndex = 0 ;
105 m_plotDomainList.resize(1);
105 m_plotDomainList.resize(1);
106
106
107 PlotDomain& domain = m_plotDomainList[m_plotDataIndex];
107 PlotDomain& domain = m_plotDomainList[m_plotDataIndex];
108 foreach(ChartItem* i ,m_chartItems)
108 foreach(ChartItem* i ,m_chartItems)
109 i->setPlotDomain(m_plotDomainList.at(m_plotDataIndex));
109 i->setPlotDomain(m_plotDomainList.at(m_plotDataIndex));
110
110 */
111 break;
111 break;
112 }
112 }
113 case QChartSeries::SeriesTypeStackedBar: {
113 case QChartSeries::SeriesTypeStackedBar: {
@@ -125,13 +125,14 void QChart::addSeries(QChartSeries* series)
125
125
126 m_chartObjectInterfaces << stackedBarGroup;
126 m_chartObjectInterfaces << stackedBarGroup;
127 childItems().append(stackedBarGroup);
127 childItems().append(stackedBarGroup);
128 /*
128 m_plotDataIndex = 0 ;
129 m_plotDataIndex = 0 ;
129 m_plotDomainList.resize(1);
130 m_plotDomainList.resize(1);
130
131
131 PlotDomain& domain = m_plotDomainList[m_plotDataIndex];
132 PlotDomain& domain = m_plotDomainList[m_plotDataIndex];
132 foreach(ChartItem* i ,m_chartItems)
133 foreach(ChartItem* i ,m_chartItems)
133 i->setPlotDomain(m_plotDomainList.at(m_plotDataIndex));
134 i->setPlotDomain(m_plotDomainList.at(m_plotDataIndex));
134
135 */
135 break;
136 break;
136 }
137 }
137 case QChartSeries::SeriesTypePercentBar: {
138 case QChartSeries::SeriesTypePercentBar: {
@@ -149,13 +150,14 void QChart::addSeries(QChartSeries* series)
149
150
150 m_chartObjectInterfaces << percentBarGroup;
151 m_chartObjectInterfaces << percentBarGroup;
151 childItems().append(percentBarGroup);
152 childItems().append(percentBarGroup);
153 /*
152 m_plotDataIndex = 0 ;
154 m_plotDataIndex = 0 ;
153 m_plotDomainList.resize(1);
155 m_plotDomainList.resize(1);
154
156
155 PlotDomain& domain = m_plotDomainList[m_plotDataIndex];
157 PlotDomain& domain = m_plotDomainList[m_plotDataIndex];
156 foreach(ChartItem* i ,m_chartItems)
158 foreach(ChartItem* i ,m_chartItems)
157 i->setPlotDomain(m_plotDomainList.at(m_plotDataIndex));
159 i->setPlotDomain(m_plotDomainList.at(m_plotDataIndex));
158
160 */
159 break;
161 break;
160 }
162 }
161 case QChartSeries::SeriesTypeScatter: {
163 case QChartSeries::SeriesTypeScatter: {
General Comments 0
You need to be logged in to leave comments. Login now