##// END OF EJS Templates
customchart with categories on Y axis
Marek Rosa -
r1649:8992f350fa1b
parent child
Show More
@@ -33,7 +33,7 int main(int argc, char *argv[])
33
33
34 //![1]
34 //![1]
35 QLineSeries* series = new QLineSeries();
35 QLineSeries* series = new QLineSeries();
36 *series << QPointF(0, 6) << QPointF(0.5, 4) << QPointF(1, 8) << QPointF(1.5, 4) << QPointF(2, 3);
36 *series << QPointF(0, 0.6) << QPointF(0.5, 0.4) << QPointF(1, 2) << QPointF(1.5, 1.2) << QPointF(2, 1.0);
37 QChart* chart = new QChart();
37 QChart* chart = new QChart();
38 chart->legend()->hide();
38 chart->legend()->hide();
39 chart->addSeries(series);
39 chart->addSeries(series);
@@ -64,7 +64,7 int main(int argc, char *argv[])
64
64
65 //![3]
65 //![3]
66 QBarCategoriesAxis* axisX = new QBarCategoriesAxis;
66 QBarCategoriesAxis* axisX = new QBarCategoriesAxis;
67 QValuesAxis* axisY = new QValuesAxis;
67 QBarCategoriesAxis* axisY = new QBarCategoriesAxis;
68
68
69 // Customize axis label font
69 // Customize axis label font
70 QFont labelsFont;
70 QFont labelsFont;
@@ -94,11 +94,14 int main(int argc, char *argv[])
94 //![4]
94 //![4]
95 axisX->append("low");
95 axisX->append("low");
96 axisX->append("optimal");
96 axisX->append("optimal");
97 axisX->append("high");
97 axisX->append("high");
98
98
99 axisX->setRange("low","high");
99 axisX->setRange("low","high");
100 axisY->setRange(0,10);
100 axisY->append("slow");
101 axisY->setTicksCount(4);
101 axisY->append("medium");
102 axisY->append("fast");
103 axisY->setRange("slow","fast");
104 // axisY->setTicksCount(4);
102 chart->setAxisX(axisX, series);
105 chart->setAxisX(axisX, series);
103 chart->setAxisY(axisY, series);
106 chart->setAxisY(axisY, series);
104 //![4]
107 //![4]
General Comments 0
You need to be logged in to leave comments. Login now