@@ -2,7 +2,7 | |||
|
2 | 2 | error( "Couldn't find the examples.pri file!" ) |
|
3 | 3 | } |
|
4 | 4 | |
|
5 |
TARGET = c |
|
|
5 | TARGET = customechart | |
|
6 | 6 | SOURCES += main.cpp |
|
7 | 7 | |
|
8 | 8 |
@@ -52,7 +52,7 int main(int argc, char *argv[]) | |||
|
52 | 52 | |
|
53 | 53 | //![1] |
|
54 | 54 | QLineSeries* series = new QLineSeries(); |
|
55 |
QPen blue(Qt:: |
|
|
55 | QPen blue(Qt::yellow); | |
|
56 | 56 | blue.setWidth(3); |
|
57 | 57 | series->setPen(blue); |
|
58 | 58 | //![1] |
@@ -62,34 +62,63 int main(int argc, char *argv[]) | |||
|
62 | 62 | //![3] |
|
63 | 63 | QChart* chart = new QChart(); |
|
64 | 64 | chart->addSeries(series); |
|
65 |
chart->setTitle(" |
|
|
65 | chart->setTitle("Simple customchart example"); | |
|
66 | 66 | //![3] |
|
67 | 67 | //![4] |
|
68 | 68 | QFont font; |
|
69 | 69 | font.setPixelSize(18); |
|
70 | 70 | chart->setTitleFont(font); |
|
71 |
chart->setTitleBrush(Qt:: |
|
|
71 | chart->setTitleBrush(Qt::yellow); | |
|
72 | 72 | |
|
73 | 73 | QLinearGradient backgroundGradient; |
|
74 |
backgroundGradient.set |
|
|
75 |
backgroundGradient.set |
|
|
74 | backgroundGradient.setStart(QPointF(0,0)); | |
|
75 | backgroundGradient.setFinalStop(QPointF(0,1)); | |
|
76 | backgroundGradient.setColorAt(0.0, 0x3cc63c); | |
|
77 | backgroundGradient.setColorAt(1.0, 0x26f626); | |
|
76 | 78 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
77 | 79 | chart->setBackgroundBrush(backgroundGradient); |
|
78 | ||
|
79 | QPen black(Qt::black); | |
|
80 | chart->axisX()->setGridLinePen(black); | |
|
81 | chart->axisX()->setAxisPen(black); | |
|
82 | chart->axisY()->setGridLinePen(black); | |
|
83 | chart->axisY()->setAxisPen(black); | |
|
84 | 80 | //![4] |
|
85 | 81 | //![5] |
|
82 | QPen black(Qt::black); | |
|
83 | QChartAxis* axisX = chart->axisX(); | |
|
84 | QChartAxis* axisY = chart->axisY(); | |
|
85 | ||
|
86 | axisX->setAxisPen(black); | |
|
87 | axisY->setAxisPen(black); | |
|
88 | axisX->setGridLineVisible(false); | |
|
89 | axisY->setGridLineVisible(false); | |
|
90 | ||
|
91 | axisY->setShadesPen(Qt::NoPen); | |
|
92 | axisY->setShadesOpacity(0.5); | |
|
93 | axisY->setShadesBrush(Qt::white); | |
|
94 | axisY->setShadesVisible(true); | |
|
95 | //![5] | |
|
96 | //![6] | |
|
97 | QChartAxisCategories* categoriesX = chart->axisX()->categories(); | |
|
98 | categoriesX->insert(1,"low"); | |
|
99 | categoriesX->insert(5,"optimal"); | |
|
100 | categoriesX->insert(10,"high"); | |
|
101 | ||
|
102 | QChartAxisCategories* categoriesY = chart->axisY()->categories(); | |
|
103 | categoriesY->insert(1,"slow"); | |
|
104 | categoriesY->insert(5,"med"); | |
|
105 | categoriesY->insert(10,"fast"); | |
|
106 | //![6] | |
|
107 | //![7] | |
|
108 | axisX->setRange(0,10); | |
|
109 | axisX->setTicksCount(4); | |
|
110 | axisY->setRange(0,10); | |
|
111 | axisY->setTicksCount(4); | |
|
112 | //![7] | |
|
113 | //![8] | |
|
86 | 114 | QChartView* chartView = new QChartView(chart); |
|
87 | 115 | chartView->setRenderHint(QPainter::Antialiasing); |
|
88 |
//![ |
|
|
116 | //![8] | |
|
117 | //![9] | |
|
89 | 118 | QMainWindow window; |
|
90 | 119 | window.setCentralWidget(chartView); |
|
91 | 120 | window.resize(400, 300); |
|
92 | 121 | window.show(); |
|
93 |
//![ |
|
|
122 | //![9] | |
|
94 | 123 | return a.exec(); |
|
95 | 124 | } |
@@ -1,11 +1,9 | |||
|
1 | 1 | TEMPLATE = subdirs |
|
2 | 2 | SUBDIRS += \ |
|
3 | 3 | areachart \ |
|
4 | #axischart \ | |
|
5 | 4 | barchart \ |
|
6 | 5 | #chartview \ |
|
7 |
c |
|
|
8 | #customcolors \ | |
|
6 | customchart \ | |
|
9 | 7 | #dynamiclinechart \ |
|
10 | 8 | #ekgchart \ |
|
11 | 9 | #gdpbarchart \ |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now