@@ -11,7 +11,7 SUBDIRS += \ | |||||
11 | #multichart \ |
|
11 | #multichart \ | |
12 | percentbarchart \ |
|
12 | percentbarchart \ | |
13 | piechart \ |
|
13 | piechart \ | |
14 |
|
|
14 | piechartdrilldown \ | |
15 | #presenterchart \ |
|
15 | #presenterchart \ | |
16 | scatterchart \ |
|
16 | scatterchart \ | |
17 | #scatterinteractions \ |
|
17 | #scatterinteractions \ |
@@ -39,11 +39,11 private: | |||||
39 | QString m_prefix; |
|
39 | QString m_prefix; | |
40 | }; |
|
40 | }; | |
41 |
|
41 | |||
42 |
class DrilldownChart : public QChart |
|
42 | class DrilldownChart : public QChart | |
43 | { |
|
43 | { | |
44 | Q_OBJECT |
|
44 | Q_OBJECT | |
45 | public: |
|
45 | public: | |
46 |
explicit DrilldownChart(Q |
|
46 | explicit DrilldownChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0):QChart(parent, wFlags), m_currentSeries(0) {} | |
47 |
|
47 | |||
48 | void changeSeries(QSeries* series) |
|
48 | void changeSeries(QSeries* series) | |
49 | { |
|
49 | { | |
@@ -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 |
set |
|
56 | setTitle(series->name()); | |
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 | public Q_SLOTS: |
|
59 | public Q_SLOTS: | |
@@ -75,9 +75,8 int main(int argc, char *argv[]) | |||||
75 |
|
75 | |||
76 | QMainWindow window; |
|
76 | QMainWindow window; | |
77 |
|
77 | |||
78 |
DrilldownChart* drilldownChart = new DrilldownChart( |
|
78 | DrilldownChart* drilldownChart = new DrilldownChart(); | |
79 |
drilldownChart->set |
|
79 | drilldownChart->setTheme(QChart::ChartThemeLight); | |
80 | drilldownChart->setChartTheme(QChart::ChartThemeLight); |
|
|||
81 | drilldownChart->setAnimationOptions(QChart::AllAnimations); |
|
80 | drilldownChart->setAnimationOptions(QChart::AllAnimations); | |
82 |
|
81 | |||
83 | QPieSeries* yearSeries = new QPieSeries(&window); |
|
82 | QPieSeries* yearSeries = new QPieSeries(&window); | |
@@ -104,7 +103,9 int main(int argc, char *argv[]) | |||||
104 |
|
103 | |||
105 | drilldownChart->changeSeries(yearSeries); |
|
104 | drilldownChart->changeSeries(yearSeries); | |
106 |
|
105 | |||
107 | window.setCentralWidget(drilldownChart); |
|
106 | QChartView* chartView = new QChartView(drilldownChart); | |
|
107 | chartView->setRenderHint(QPainter::Antialiasing); | |||
|
108 | window.setCentralWidget(chartView); | |||
108 | window.resize(800, 600); |
|
109 | window.resize(800, 600); | |
109 | window.show(); |
|
110 | window.show(); | |
110 |
|
111 |
General Comments 0
You need to be logged in to leave comments.
Login now