@@ -22,6 +22,7 | |||||
22 | #include <QMainWindow> |
|
22 | #include <QMainWindow> | |
23 | #include <QChartView> |
|
23 | #include <QChartView> | |
24 | #include <QLineSeries> |
|
24 | #include <QLineSeries> | |
|
25 | #include <QValuesAxis> | |||
25 |
|
26 | |||
26 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
27 | QTCOMMERCIALCHART_USE_NAMESPACE | |
27 |
|
28 | |||
@@ -35,6 +36,7 int main(int argc, char *argv[]) | |||||
35 | QChart* chart = new QChart(); |
|
36 | QChart* chart = new QChart(); | |
36 | chart->legend()->hide(); |
|
37 | chart->legend()->hide(); | |
37 | chart->addSeries(series); |
|
38 | chart->addSeries(series); | |
|
39 | chart->createDefaultAxes(); | |||
38 | //![1] |
|
40 | //![1] | |
39 |
|
41 | |||
40 | //![2] |
|
42 | //![2] | |
@@ -61,8 +63,8 int main(int argc, char *argv[]) | |||||
61 | //![2] |
|
63 | //![2] | |
62 |
|
64 | |||
63 | //![3] |
|
65 | //![3] | |
64 | QAxis* axisX = chart->axisX(); |
|
66 | QValuesAxis* axisX = qobject_cast<QValuesAxis *>(chart->axisX()); | |
65 | QAxis* axisY = chart->axisY(); |
|
67 | QValuesAxis* axisY = qobject_cast<QValuesAxis *>(chart->axisY()); | |
66 |
|
68 | |||
67 | // Customize axis label font |
|
69 | // Customize axis label font | |
68 | QFont labelsFont; |
|
70 | QFont labelsFont; | |
@@ -90,15 +92,15 int main(int argc, char *argv[]) | |||||
90 | //![3] |
|
92 | //![3] | |
91 |
|
93 | |||
92 | //![4] |
|
94 | //![4] | |
93 | QAxisCategories* categoriesX = chart->axisX()->categories(); |
|
95 | // QAxisCategories* categoriesX = chart->axisX()->categories(); | |
94 | categoriesX->insert(1,"low"); |
|
96 | // categoriesX->insert(1,"low"); | |
95 | categoriesX->insert(5,"optimal"); |
|
97 | // categoriesX->insert(5,"optimal"); | |
96 | categoriesX->insert(10,"high"); |
|
98 | // categoriesX->insert(10,"high"); | |
97 |
|
99 | |||
98 | QAxisCategories* categoriesY = chart->axisY()->categories(); |
|
100 | // QAxisCategories* categoriesY = chart->axisY()->categories(); | |
99 | categoriesY->insert(1,"slow"); |
|
101 | // categoriesY->insert(1,"slow"); | |
100 | categoriesY->insert(5,"med"); |
|
102 | // categoriesY->insert(5,"med"); | |
101 | categoriesY->insert(10,"fast"); |
|
103 | // categoriesY->insert(10,"fast"); | |
102 |
|
104 | |||
103 | axisX->setRange(0,10); |
|
105 | axisX->setRange(0,10); | |
104 | axisX->setTicksCount(4); |
|
106 | axisX->setTicksCount(4); |
General Comments 0
You need to be logged in to leave comments.
Login now