@@ -53,7 +53,7 public: | |||||
53 | removeSeries(m_currentSeries); |
|
53 | removeSeries(m_currentSeries); | |
54 | m_currentSeries = series; |
|
54 | m_currentSeries = series; | |
55 | addSeries(series); |
|
55 | addSeries(series); | |
56 |
setChartTitle(series-> |
|
56 | setChartTitle(series->name()); | |
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 | public Q_SLOTS: |
|
59 | public Q_SLOTS: | |
@@ -81,7 +81,7 int main(int argc, char *argv[]) | |||||
81 | drilldownChart->setAnimationOptions(QChart::AllAnimations); |
|
81 | drilldownChart->setAnimationOptions(QChart::AllAnimations); | |
82 |
|
82 | |||
83 | QPieSeries* yearSeries = new QPieSeries(&window); |
|
83 | QPieSeries* yearSeries = new QPieSeries(&window); | |
84 |
yearSeries->set |
|
84 | yearSeries->setName("Sales by year - All"); | |
85 |
|
85 | |||
86 | QList<QString> months; |
|
86 | QList<QString> months; | |
87 | months << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; |
|
87 | months << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; | |
@@ -90,7 +90,7 int main(int argc, char *argv[]) | |||||
90 |
|
90 | |||
91 | foreach (QString name, names) { |
|
91 | foreach (QString name, names) { | |
92 | QPieSeries* series = new QPieSeries(&window); |
|
92 | QPieSeries* series = new QPieSeries(&window); | |
93 |
series->set |
|
93 | series->setName("Sales by month - " + name); | |
94 |
|
94 | |||
95 | foreach (QString month, months) |
|
95 | foreach (QString month, months) | |
96 | *series << new DrilldownSlice(qrand() % 1000, month, yearSeries); |
|
96 | *series << new DrilldownSlice(qrand() % 1000, month, yearSeries); |
@@ -48,7 +48,7 public: | |||||
48 | removeSeries(m_currentSeries); |
|
48 | removeSeries(m_currentSeries); | |
49 | m_currentSeries = series; |
|
49 | m_currentSeries = series; | |
50 | addSeries(series); |
|
50 | addSeries(series); | |
51 |
setChartTitle(series-> |
|
51 | setChartTitle(series->name()); | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | public Q_SLOTS: |
|
54 | public Q_SLOTS: | |
@@ -85,7 +85,7 int main(int argc, char *argv[]) | |||||
85 | //! [4] |
|
85 | //! [4] | |
86 | // Create drilldown structure |
|
86 | // Create drilldown structure | |
87 | DrilldownBarSeries* seasonSeries = new DrilldownBarSeries(months, drilldownChart); |
|
87 | DrilldownBarSeries* seasonSeries = new DrilldownBarSeries(months, drilldownChart); | |
88 |
seasonSeries->set |
|
88 | seasonSeries->setName("Crop by month - Season"); | |
89 |
|
89 | |||
90 | // Each month in season series has drilldown series for weekly data |
|
90 | // Each month in season series has drilldown series for weekly data | |
91 | foreach (QString month, months) { |
|
91 | foreach (QString month, months) { | |
@@ -97,7 +97,7 int main(int argc, char *argv[]) | |||||
97 | // Drilling down from weekly data brings us back to season data. |
|
97 | // Drilling down from weekly data brings us back to season data. | |
98 | foreach (QString week, weeks) { |
|
98 | foreach (QString week, weeks) { | |
99 | weeklySeries->mapDrilldownSeries(week, seasonSeries); |
|
99 | weeklySeries->mapDrilldownSeries(week, seasonSeries); | |
100 |
weeklySeries->set |
|
100 | weeklySeries->setName(QString("Crop by week - " + month)); | |
101 | } |
|
101 | } | |
102 |
|
102 | |||
103 | // Use right click signal to implement drilldown |
|
103 | // Use right click signal to implement drilldown | |
@@ -134,7 +134,7 int main(int argc, char *argv[]) | |||||
134 | //! [6] |
|
134 | //! [6] | |
135 | // Show season series in initial view |
|
135 | // Show season series in initial view | |
136 | drilldownChart->changeSeries(seasonSeries); |
|
136 | drilldownChart->changeSeries(seasonSeries); | |
137 |
drilldownChart->setChartTitle(seasonSeries-> |
|
137 | drilldownChart->setChartTitle(seasonSeries->name()); | |
138 | //! [6] |
|
138 | //! [6] | |
139 |
|
139 | |||
140 | drilldownChart->axisX()->setGridLineVisible(false); |
|
140 | drilldownChart->axisX()->setGridLineVisible(false); |
General Comments 0
You need to be logged in to leave comments.
Login now