@@ -22,8 +22,7 | |||
|
22 | 22 | #include <QMainWindow> |
|
23 | 23 | #include <QChartView> |
|
24 | 24 | #include <QLineSeries> |
|
25 |
#include <Q |
|
|
26 | #include <QBarCategoriesAxis> | |
|
25 | #include <QIntervalsAxis> | |
|
27 | 26 | |
|
28 | 27 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
29 | 28 | |
@@ -33,7 +32,7 int main(int argc, char *argv[]) | |||
|
33 | 32 | |
|
34 | 33 | //![1] |
|
35 | 34 | QLineSeries* series = new QLineSeries(); |
|
36 |
*series << QPointF(0, |
|
|
35 | *series << QPointF(0, 6) << QPointF(9, 4) << QPointF(15, 20) << QPointF(25, 12) << QPointF(29, 26); | |
|
37 | 36 | QChart* chart = new QChart(); |
|
38 | 37 | chart->legend()->hide(); |
|
39 | 38 | chart->addSeries(series); |
@@ -63,8 +62,8 int main(int argc, char *argv[]) | |||
|
63 | 62 | //![2] |
|
64 | 63 | |
|
65 | 64 | //![3] |
|
66 |
Q |
|
|
67 |
Q |
|
|
65 | QIntervalsAxis* axisX = new QIntervalsAxis(); | |
|
66 | QIntervalsAxis* axisY = new QIntervalsAxis(); | |
|
68 | 67 | |
|
69 | 68 | // Customize axis label font |
|
70 | 69 | QFont labelsFont; |
@@ -92,18 +91,22 int main(int argc, char *argv[]) | |||
|
92 | 91 | //![3] |
|
93 | 92 | |
|
94 | 93 | //![4] |
|
95 | axisX->append("low"); | |
|
96 | axisX->append("optimal"); | |
|
97 | axisX->append("high"); | |
|
98 |
axisX->setRange( |
|
|
99 | ||
|
100 | axisY->append("slow"); | |
|
101 |
axisY->append(" |
|
|
102 |
axisY->append(" |
|
|
103 |
axisY-> |
|
|
94 | axisX->append("low", 10); | |
|
95 | axisX->append("optimal", 20); | |
|
96 | axisX->append("high", 30); | |
|
97 | axisX->setRange(0, 30); | |
|
98 | // axisX->setRange("low","high"); | |
|
99 | ||
|
100 | axisY->append("slow", 10); | |
|
101 | axisY->append("med", 20); | |
|
102 | axisY->append("fast", 30); | |
|
103 | axisY->setRange(0, 30); | |
|
104 | // axisY->setRange("slow","fast"); | |
|
104 | 105 | |
|
105 | 106 | chart->setAxisX(axisX, series); |
|
106 | 107 | chart->setAxisY(axisY, series); |
|
108 | axisX->setRange(0, 30); | |
|
109 | axisY->setRange(0, 30); | |
|
107 | 110 | //![4] |
|
108 | 111 | |
|
109 | 112 | //![5] |
@@ -100,12 +100,9 void ChartIntervalAxisY::updateGeometry() | |||
|
100 | 100 | |
|
101 | 101 | if (i < ticksList.count()) |
|
102 | 102 | labelItem->setPos(m_rect.left() - rect.width() - label_padding , layout[i] + (layout[i + 1] - layout[i]) / 2 - center.y()); |
|
103 | // labelItem->setPos(layout[i] + (layout[i + 1] - layout[i]) / 2 - center.x(), m_rect.bottom() + label_padding); | |
|
104 | 103 | else |
|
105 | 104 | labelItem->setPos(m_rect.left() - rect.width() - label_padding , layout[i]-center.y()); |
|
106 | 105 | |
|
107 | // labelItem->setPos(m_rect.left() - rect.width() - label_padding , layout[i]-center.y()); | |
|
108 | ||
|
109 | 106 | if(labelItem->pos().y()+rect.height()>height) { |
|
110 | 107 | labelItem->setVisible(false); |
|
111 | 108 | lineItem->setVisible(false); |
General Comments 0
You need to be logged in to leave comments.
Login now