@@ -20,8 +20,7 | |||||
20 | Class will implement \c handleTimeout() slot which we are going to use to trigger switching between different chart presentations. |
|
20 | Class will implement \c handleTimeout() slot which we are going to use to trigger switching between different chart presentations. | |
21 | We are also going to provide \c handlePoitClicked() slot which will show clicked point on the chart. |
|
21 | We are also going to provide \c handlePoitClicked() slot which will show clicked point on the chart. | |
22 | Class members \c m_series and \c m_titles are going to store series and related titles. In example we are going to present data as a line chart |
|
22 | Class members \c m_series and \c m_titles are going to store series and related titles. In example we are going to present data as a line chart | |
23 | using QLineSeries , as scatter chart using QScatterSeries, as a spline chart using QSplineSeries and a area chart using QAreaSeries. We create needed instances in constructor of ChartView class. |
|
23 | using QLineSeries , as scatter chart using QScatterSeries, as a spline chart using QSplineSeries and a area chart using QAreaSeries. We create needed instances in constructor of ChartView class. | |
24 | We set custom line and points colors. |
|
|||
25 |
|
24 | |||
26 | \snippet ../examples/presenterchart/chartview.cpp 1 |
|
25 | \snippet ../examples/presenterchart/chartview.cpp 1 | |
27 |
|
26 |
@@ -36,29 +36,15 m_index(-1),m_chart(chart) | |||||
36 | //![1] |
|
36 | //![1] | |
37 | QLineSeries* series0 = new QLineSeries(); |
|
37 | QLineSeries* series0 = new QLineSeries(); | |
38 | series0->setName("line"); |
|
38 | series0->setName("line"); | |
39 | QPen blue(Qt::blue); |
|
|||
40 | blue.setWidth(3); |
|
|||
41 | series0->setPen(blue); |
|
|||
42 |
|
39 | |||
43 | QScatterSeries* series1 = new QScatterSeries(); |
|
40 | QScatterSeries* series1 = new QScatterSeries(); | |
44 | series1->setName("scatter"); |
|
41 | series1->setName("scatter"); | |
45 | QPen red(Qt::red); |
|
|||
46 | red.setWidth(3); |
|
|||
47 | series1->setPen(red); |
|
|||
48 | series1->setBrush(Qt::white); |
|
|||
49 |
|
42 | |||
50 | QSplineSeries* series2 = new QSplineSeries(); |
|
43 | QSplineSeries* series2 = new QSplineSeries(); | |
51 | series2->setName("spline"); |
|
44 | series2->setName("spline"); | |
52 | QPen green(Qt::green); |
|
|||
53 | green.setWidth(3); |
|
|||
54 | series2->setPen(green); |
|
|||
55 |
|
45 | |||
56 | QAreaSeries* series3 = new QAreaSeries(series0); |
|
46 | QAreaSeries* series3 = new QAreaSeries(series0); | |
57 | series3->setName("area"); |
|
47 | series3->setName("area"); | |
58 | QPen yellow(Qt::black); |
|
|||
59 | yellow.setWidth(3); |
|
|||
60 | series3->setPen(yellow); |
|
|||
61 | series3->setBrush(Qt::yellow); |
|
|||
62 | //![1] |
|
48 | //![1] | |
63 |
|
49 | |||
64 | //![2] |
|
50 | //![2] |
General Comments 0
You need to be logged in to leave comments.
Login now