##// END OF EJS Templates
Customchart partially fixed (no categories on axes)
Marek Rosa -
r1631:3d0288033004
parent child
Show More
@@ -22,6 +22,7
22 22 #include <QMainWindow>
23 23 #include <QChartView>
24 24 #include <QLineSeries>
25 #include <QValuesAxis>
25 26
26 27 QTCOMMERCIALCHART_USE_NAMESPACE
27 28
@@ -35,6 +36,7 int main(int argc, char *argv[])
35 36 QChart* chart = new QChart();
36 37 chart->legend()->hide();
37 38 chart->addSeries(series);
39 chart->createDefaultAxes();
38 40 //![1]
39 41
40 42 //![2]
@@ -61,8 +63,8 int main(int argc, char *argv[])
61 63 //![2]
62 64
63 65 //![3]
64 QAxis* axisX = chart->axisX();
65 QAxis* axisY = chart->axisY();
66 QValuesAxis* axisX = qobject_cast<QValuesAxis *>(chart->axisX());
67 QValuesAxis* axisY = qobject_cast<QValuesAxis *>(chart->axisY());
66 68
67 69 // Customize axis label font
68 70 QFont labelsFont;
@@ -90,15 +92,15 int main(int argc, char *argv[])
90 92 //![3]
91 93
92 94 //![4]
93 QAxisCategories* categoriesX = chart->axisX()->categories();
94 categoriesX->insert(1,"low");
95 categoriesX->insert(5,"optimal");
96 categoriesX->insert(10,"high");
97
98 QAxisCategories* categoriesY = chart->axisY()->categories();
99 categoriesY->insert(1,"slow");
100 categoriesY->insert(5,"med");
101 categoriesY->insert(10,"fast");
95 // QAxisCategories* categoriesX = chart->axisX()->categories();
96 // categoriesX->insert(1,"low");
97 // categoriesX->insert(5,"optimal");
98 // categoriesX->insert(10,"high");
99
100 // QAxisCategories* categoriesY = chart->axisY()->categories();
101 // categoriesY->insert(1,"slow");
102 // categoriesY->insert(5,"med");
103 // categoriesY->insert(10,"fast");
102 104
103 105 axisX->setRange(0,10);
104 106 axisX->setTicksCount(4);
@@ -6,7 +6,7 CURRENTLY_BUILDING_COMPONENTS = "examples"
6 6 TEMPLATE = subdirs
7 7 SUBDIRS += \
8 8 areachart \
9 #customchart \
9 customchart \
10 10 linechart \
11 11 percentbarchart \
12 12 piechart \
General Comments 0
You need to be logged in to leave comments. Login now