@@ -1,8 +1,8 | |||
|
1 | 1 | /*! |
|
2 | 2 | \example demos/audio |
|
3 | 3 | \title Audio demo |
|
4 | 4 | \subtitle |
|
5 | 5 | |
|
6 | This demos shows drawing of the dynamic data (microphon input) | |
|
6 | This demos shows drawing of the dynamic data (microphone input) | |
|
7 | 7 | \image demos_audio.png |
|
8 | 8 | */ |
@@ -1,32 +1,32 | |||
|
1 | 1 | /*! |
|
2 | 2 | \example demos/qmlaxes |
|
3 | 3 | \title Qml Axes |
|
4 | 4 | \subtitle |
|
5 | 5 | |
|
6 | 6 | This is a demonstration of how to use axes in your QML application. |
|
7 | 7 | |
|
8 | 8 | \table |
|
9 | 9 | \row |
|
10 | 10 | \o \br |
|
11 | 11 | We begin with a chart that has a line series and a scatter series with random |
|
12 |
data. Both series |
|
|
12 | data. Both series use the same axes. | |
|
13 | 13 | \br |
|
14 | 14 | \br |
|
15 | 15 | \snippet ../demos/qmlaxes/qml/qmlaxes/View1.qml 1 |
|
16 | 16 | \o \inlineimage demos_qmlaxes1.png |
|
17 | 17 | \row |
|
18 | 18 | \o \br |
|
19 | 19 | The next example shows a chart with some accurate historical data that makes us to use a DateTimeAxis. |
|
20 | 20 | \br |
|
21 | 21 | \br |
|
22 | 22 | \snippet ../demos/qmlaxes/qml/qmlaxes/View2.qml 1 |
|
23 | 23 | \o \inlineimage demos_qmlaxes2.png |
|
24 | 24 | \row |
|
25 | 25 | \o \br |
|
26 | 26 | And the final example with a chart that uses a CategoryAxis to make the data easier to understand. |
|
27 | 27 | \br |
|
28 | 28 | \br |
|
29 | 29 | \snippet ../demos/qmlaxes/qml/qmlaxes/View3.qml 1 |
|
30 | 30 | \o \inlineimage demos_qmlaxes3.png |
|
31 | 31 | \endtable |
|
32 | 32 | */ |
@@ -1,41 +1,41 | |||
|
1 | 1 | /*! |
|
2 | 2 | \example examples/legendmarkers |
|
3 | 3 | \title LegendMarkers Example |
|
4 | 4 | \subtitle |
|
5 | 5 | |
|
6 | 6 | The example shows how to make use of legend markers. In this example we create an application which uses QLegendMarker clicked signal to show/hide corresponding series |
|
7 | 7 | in chart. The connect marker button connects clicked signal from all markers in legend to handleMarkerClicked slot. |
|
8 | 8 | |
|
9 | 9 | \image examples_legendmarkers.png |
|
10 | 10 | |
|
11 | 11 | Our application has buttons for adding or removing series in chart and button to connect or disconnect legend markers clicked signal to our handler. In the image above, |
|
12 | 12 | we have connected the markers and clicked on one of them. |
|
13 | 13 | |
|
14 | 14 | \snippet ../examples/legendmarkers/mainwidget.cpp 1 |
|
15 | 15 | |
|
16 |
Here we connect the markers in legend to our handler. To avoid conn |
|
|
16 | Here we connect the markers in legend to our handler. To avoid connecting same marker more than once, we first disconnect it. | |
|
17 | 17 | |
|
18 | 18 | \snippet ../examples/legendmarkers/mainwidget.cpp 2 |
|
19 | 19 | |
|
20 | 20 | Here we disconnect all markers from our handler. |
|
21 | 21 | |
|
22 | 22 | \snippet ../examples/legendmarkers/mainwidget.cpp 3 |
|
23 | 23 | |
|
24 | 24 | In our handler we first cast the sender of event to QLegendMarker. |
|
25 | 25 | |
|
26 | 26 | \snippet ../examples/legendmarkers/mainwidget.cpp 4 |
|
27 | 27 | |
|
28 | 28 | Then we check the type of marker. This is needed if we want to access the detailed methods of the marker and cast it to correct type. |
|
29 | 29 | If all we need is the pointer to QAbstractSeries, the casting isn't necessary. In case of pie or bar series, we may need the pointer to related QPieSlice or QBarSet. |
|
30 | 30 | |
|
31 | 31 | \snippet ../examples/legendmarkers/mainwidget.cpp 5 |
|
32 | 32 | |
|
33 | 33 | We want to toggle the visibility of the series, when marker is clicked. To do so, we get the pointer to related series from marker and toggle its visibility. |
|
34 | 34 | Because the legend marker follows the visibility of the series by default, we also set the marked back to visible. If we don't do that, the marker will be |
|
35 | 35 | invisible in legend and we can't click on it anymore. |
|
36 | 36 | |
|
37 | 37 | \snippet ../examples/legendmarkers/mainwidget.cpp 6 |
|
38 | 38 | |
|
39 | 39 | Instead of making marker invisible when series is hidden, we dim the color of the marker. Here we do it by modifying the color of the laberBrush. |
|
40 | 40 | |
|
41 | 41 | */ |
@@ -1,36 +1,36 | |||
|
1 | 1 | /*! |
|
2 | 2 | \example examples/multiaxis |
|
3 | 3 | \title Multiple axes example |
|
4 | 4 | \subtitle |
|
5 | 5 | |
|
6 | 6 | The example shows how to create simple chart with two vertical axes. One for each series. |
|
7 | 7 | |
|
8 | 8 | \image examples_multiaxis.png |
|
9 | 9 | |
|
10 | 10 | Create QChart instance, hide the legend of the chart and set its title. |
|
11 | 11 | |
|
12 | 12 | \snippet ../examples/multiaxis/main.cpp 1 |
|
13 | 13 | |
|
14 | 14 | Create a QValueAxis instance that will be used as a horizontal axis by both series and add it the bottom of the chart. |
|
15 | 15 | Axis can be sharted between many series, but each series can have only one vertical and horizontal axis. |
|
16 | 16 | |
|
17 | 17 | \snippet ../examples/multiaxis/main.cpp 2 |
|
18 | 18 | |
|
19 | 19 | Create the first series, add the data to it, finally add the series to the chart. Instantiate its own Y-axis, add it to the chart then attach both the common X-axis and the series specific Y-axis. |
|
20 | 20 | In this example the color of the axis line is set to be the same as the color of the series to make it possible to distinguish which axis is attached to which series. |
|
21 | 21 | |
|
22 | 22 | \snippet ../examples/multiaxis/main.cpp 3 |
|
23 | 23 | |
|
24 | 24 | Similarly prepare another series. This time different axis type is used. Additionally grid lines color is also set to be the same as the color of the series. |
|
25 | 25 | |
|
26 | 26 | \snippet ../examples/multiaxis/main.cpp 4 |
|
27 | 27 | |
|
28 |
Create a QChartView object with QChart as a parameter. Ena |
|
|
28 | Create a QChartView object with QChart as a parameter. Enable Antialiasing to have the rendered splines look nicer. | |
|
29 | 29 | |
|
30 | 30 | \snippet ../examples/multiaxis/main.cpp 5 |
|
31 | 31 | |
|
32 | 32 | Chart is ready to be shown. |
|
33 | 33 | |
|
34 | 34 | \snippet ../examples/multiaxis/main.cpp 6 |
|
35 | 35 | |
|
36 | 36 | */ |
@@ -1,9 +1,9 | |||
|
1 | 1 | /*! |
|
2 | 2 | \example examples/scatterinteractions |
|
3 |
\title Scatter |
|
|
3 | \title ScatterInteractions Example | |
|
4 | 4 | \subtitle |
|
5 | 5 | |
|
6 | 6 | The example shows how to create simple scatter chart and how to interact with the chart. |
|
7 | 7 | |
|
8 | 8 | \image examples_scatterinteractions.png |
|
9 | 9 | */ |
@@ -1,138 +1,138 | |||
|
1 | 1 | /*! |
|
2 | 2 | \page examples.html |
|
3 | 3 | \title QtCommercial Charts Examples |
|
4 | 4 | \keyword Examples |
|
5 | 5 | |
|
6 | 6 | \raw HTML |
|
7 | 7 | <div class="qchart"> |
|
8 | 8 | |
|
9 | 9 | <table> |
|
10 | 10 | <tr> |
|
11 | 11 | <td><a href="examples-areachart.html">Area Chart</a></td> |
|
12 | 12 | <td><a href="examples-barchart.html">Bar Chart</a></td> |
|
13 | 13 | </tr> |
|
14 | 14 | <tr> |
|
15 | 15 | <td><a href="examples-areachart.html"><img src="images/examples_areachart.png" width="300" alt="Area Chart" /></a></td> |
|
16 | 16 | <td><a href="examples-barchart.html"><img src="images/examples_barchart.png" width="300" alt="Bar Chart" /></a></td> |
|
17 | 17 | </tr> |
|
18 | 18 | |
|
19 | 19 | <tr> |
|
20 | 20 | <td><a href="examples-barmodelmapper.html">Bar Chart from Model</a></td> |
|
21 | 21 | <td><a href="examples-customchart.html">Custom Chart</a></td> |
|
22 | 22 | </tr> |
|
23 | 23 | <tr> |
|
24 | 24 | <td><a href="examples-barmodelmapper.html"><img src="images/examples_barmodelmapper.png" width="300" alt="Bar Chart from Model" /></a></td> |
|
25 | 25 | <td><a href="examples-customchart.html"><img src="images/examples_customchart.png" width="300" alt="Custom Chart" /></a></td> |
|
26 | 26 | </tr> |
|
27 | 27 | |
|
28 | 28 | <tr> |
|
29 | 29 | <td><a href="examples-datetimeaxis.html">DateTimeAxis Example</a></td> |
|
30 | 30 | <td><a href="examples-donutbreakdown.html">Donut Breakdown Chart</a></td> |
|
31 | 31 | </tr> |
|
32 | 32 | <tr> |
|
33 | 33 | <td><a href="examples-datetimeaxis.html"><img src="images/examples_datetimeaxis.png" width="300" alt="DateTimeAxis Example" /></a></td> |
|
34 | 34 | <td><a href="examples-donutbreakdown.html"><img src="images/examples_donutbreakdown.png" width="300" alt="Donut Breakdown Chart" /></a></td> |
|
35 | 35 | </tr> |
|
36 | 36 | |
|
37 | 37 | <tr> |
|
38 | 38 | <td><a href="examples-donutchart.html">Donut Chart</a></td> |
|
39 | 39 | <td><a href="examples-horizontalbarchart.html">Horizontal Bar Chart</a></td> |
|
40 | 40 | </tr> |
|
41 | 41 | <tr> |
|
42 | 42 | <td><a href="examples-donutchart.html"><img src="images/examples_donutchart.png" width="300" alt="Donut Chart" /></a></td> |
|
43 | 43 | <td><a href="examples-horizontalbarchart.html"><img src="images/examples_horizontalbarchart.png" width="300" alt="Horizontal Bar Chart" /></a></td> |
|
44 | 44 | </tr> |
|
45 | 45 | |
|
46 | 46 | <tr> |
|
47 | 47 | <td><a href="examples-horizontalpercentbarchart.html">Horizontal Percent Bar Chart</a></td> |
|
48 | 48 | <td><a href="examples-horizontalstackedbarchart.html">Horizontal Stacked Bar Chart</a></td> |
|
49 | 49 | </tr> |
|
50 | 50 | <tr> |
|
51 | 51 | <td><a href="examples-horizontalpercentbarchart.html"><img src="images/examples_horizontalpercentbarchart.png" width="300" alt="Horizontal Percent Bar Chart" /></a></td> |
|
52 | 52 | <td><a href="examples-horizontalstackedbarchart.html"><img src="images/examples_horizontalstackedbarchart.png" width="300" alt="Horizontal Stacked Bar Chart" /></a></td> |
|
53 | 53 | </tr> |
|
54 | 54 | |
|
55 | 55 | <tr> |
|
56 | 56 | <td><a href="examples-legend.html">Legend</a></td> |
|
57 | 57 | <td><a href="examples-legendmarkers.html">Legend Markers</a></td> |
|
58 | 58 | </tr> |
|
59 | 59 | <tr> |
|
60 | 60 | <td><a href="examples-legend.html"><img src="images/examples_legend_detach.png" width="300" alt="Legend" /></a></td> |
|
61 | 61 | <td><a href="examples-legendmarkers.html"><img src="images/examples_legendmarkers.png" width="300" alt="Legend Markers" /></a></td> |
|
62 | 62 | </tr> |
|
63 | 63 | |
|
64 | 64 | <tr> |
|
65 | 65 | <td><a href="examples-lineandbar.html">Line and Barchart</a></td> |
|
66 | 66 | <td><a href="examples-linechart.html">Line Chart</a></td> |
|
67 | 67 | </tr> |
|
68 | 68 | <tr> |
|
69 | 69 | <td><a href="examples-lineandbar.html"><img src="images/examples_lineandbar.png" width="300" alt="Line and Barchart" /></a></td> |
|
70 | 70 | <td><a href="examples-linechart.html"><img src="images/examples_linechart.png" width="300" alt="Line Chart" /></a></td> |
|
71 | 71 | </tr> |
|
72 | 72 | |
|
73 | 73 | <tr> |
|
74 |
<td><a href="examples-logvalueaxis.html">Logar |
|
|
74 | <td><a href="examples-logvalueaxis.html">Logarithmic axis</a></td> | |
|
75 | 75 | <td><a href="examples-modeldata.html">Model Data</a></td> |
|
76 | 76 | </tr> |
|
77 | 77 | <tr> |
|
78 | 78 | <td><a href="examples-logvalueaxis.html"><img src="images/examples_logvalueaxis.png" width="300" alt="Logarythmix axis" /></a></td> |
|
79 | 79 | <td><a href="examples-modeldata.html"><img src="images/examples_modeldata.png" width="300" alt="Model Data" /></a></td> |
|
80 | 80 | </tr> |
|
81 | 81 | |
|
82 | 82 | <tr> |
|
83 | 83 | <td><a href="examples-multiaxis.html">Multiple axes</a></td> |
|
84 | 84 | <td><a href="examples-percentbarchart.html">Percent Bar Chart</a></td> |
|
85 | 85 | </tr> |
|
86 | 86 | <tr> |
|
87 | 87 | <td><a href="examples-multiaxis.html"><img src="images/examples_multiaxis.png" width="300" alt="Multiple axes" /></a></td> |
|
88 | 88 | <td><a href="examples-percentbarchart.html"><img src="images/examples_percentbarchart.png" width="300" alt="Percent Bar Chart" /></a></td> |
|
89 | 89 | </tr> |
|
90 | 90 | |
|
91 | 91 | <tr> |
|
92 | 92 | <td><a href="examples-piechart.html">Pie Chart</a></td> |
|
93 | 93 | <td><a href="examples-piechartdrilldown.html">Pie Chart Drilldown</a></td> |
|
94 | 94 | </tr> |
|
95 | 95 | <tr> |
|
96 | 96 | <td><a href="examples-piechart.html"><img src="images/examples_piechart.png" width="300" alt="Pie Chart" /></a></td> |
|
97 | 97 | <td><a href="examples-piechartdrilldown.html"><img src="images/examples_piechartdrill2.png" width="300" alt="Pie Chart Drilldown" /></a></td> |
|
98 | 98 | </tr> |
|
99 | 99 | |
|
100 | 100 | <tr> |
|
101 | 101 | <td><a href="examples-scatterchart.html">Scatter chart</a></td> |
|
102 | 102 | <td><a href="examples-scatterinteractions.html">Scatter Interactions</a></td> |
|
103 | 103 | </tr> |
|
104 | 104 | <tr> |
|
105 | 105 | <td><a href="examples-scatterchart.html"><img src="images/examples_scatterchart.png" width="300" alt="Scatter chart" /></a></td> |
|
106 | 106 | <td><a href="examples-scatterinteractions.html"><img src="images/examples_scatterinteractions.png" width="300" alt="Scatter Interactions" /></a></td> |
|
107 | 107 | </tr> |
|
108 | 108 | |
|
109 | 109 | <tr> |
|
110 | 110 | <td><a href="examples-splinechart.html">Spline Chart</a></td> |
|
111 | 111 | <td><a href="examples-stackedbarchart.html">Stacked Bar Chart</a></td> |
|
112 | 112 | </tr> |
|
113 | 113 | <tr> |
|
114 | 114 | <td><a href="examples-splinechart.html"><img src="images/examples_splinechart.png" width="300" alt="Spline Chart" /></a></td> |
|
115 | 115 | <td><a href="examples-stackedbarchart.html"><img src="images/examples_stackedbarchart.png" width="300" alt="Stacked Bar Chart" /></a></td> |
|
116 | 116 | </tr> |
|
117 | 117 | |
|
118 | 118 | <tr> |
|
119 | 119 | <td><a href="examples-stackedbarchartdrilldown.html">Stacked Bar Chart Drilldown</a></td> |
|
120 | 120 | <td><a href="examples-temperaturerecords.html">Temperature Records</a></td> |
|
121 | 121 | </tr> |
|
122 | 122 | <tr> |
|
123 | 123 | <td><a href="examples-stackedbarchartdrilldown.html"><img src="images/examples_stackedbarchartdrilldown1.png" width="300" alt="Stacked Bar Chart Drilldown" /></a></td> |
|
124 | 124 | <td><a href="examples-temperaturerecords.html"><img src="images/examples_temperaturerecords.png" width="300" alt="Temperature Records" /></a></td> |
|
125 | 125 | </tr> |
|
126 | 126 | |
|
127 | 127 | <tr> |
|
128 | 128 | <td><a href="examples-zoomlinechart.html">Zoom Line</a></td> |
|
129 | 129 | </tr> |
|
130 | 130 | <tr> |
|
131 | 131 | <td><a href="examples-zoomlinechart.html"><img src="images/examples_zoomlinechart1.png" width="300" alt="Zoom Line" /></a></td> |
|
132 | 132 | </tr> |
|
133 | 133 | |
|
134 | 134 | </table> |
|
135 | 135 | </div> |
|
136 | 136 | \endraw |
|
137 | 137 | |
|
138 | 138 | */ |
@@ -1,66 +1,66 | |||
|
1 | 1 | /*! |
|
2 | 2 | \page gettingstarted.html |
|
3 | 3 | \title QtCommercial Charts getting started |
|
4 | 4 | \keyword Introduction |
|
5 | 5 | |
|
6 | 6 | Compiling: |
|
7 | 7 | \code |
|
8 | 8 | qmake CONFIG+=release |
|
9 | 9 | make |
|
10 | 10 | make install |
|
11 | 11 | \endcode |
|
12 | 12 | |
|
13 | 13 | Depending on the OS and the compiler you are using "make" might need to be replaced with another command like: nmake, mingw32-make, etc. |
|
14 | 14 | |
|
15 | 15 | To uninstall the QtCommercialCharts run: |
|
16 | 16 | \code |
|
17 | 17 | make uninstall |
|
18 | 18 | \endcode |
|
19 | 19 | |
|
20 | 20 | Compiling as a static library (lib only): |
|
21 | 21 | \code |
|
22 | 22 | qmake CONFIG+=staticlib |
|
23 | 23 | make |
|
24 | 24 | make install |
|
25 | 25 | \endcode |
|
26 | 26 | |
|
27 | 27 | Building both debug and release at the same time: |
|
28 | 28 | \code |
|
29 | 29 | qmake CONFIG+="debug_and_release build_all" |
|
30 | 30 | make |
|
31 | 31 | make install |
|
32 | 32 | \endcode |
|
33 | 33 | |
|
34 | 34 | Please take a note that the \i build_all option is necessary for the install to work correctly. Otherwise it will not install both versions. |
|
35 | 35 | |
|
36 | 36 | \bold {New project} |
|
37 | 37 | |
|
38 | 38 | Create a new project in a usual way and then add to your project's *.pro file following line: |
|
39 | 39 | |
|
40 | 40 | \code |
|
41 | 41 | CONFIG += qtcommercialchart |
|
42 | 42 | \endcode |
|
43 | 43 | |
|
44 | 44 | \bold {Widget project} |
|
45 | 45 | |
|
46 | 46 | To use the QCharts classes add QtCommercialChart namespace macro in your header file. |
|
47 | 47 | \code |
|
48 | 48 | #include<QWidget> |
|
49 | 49 | #include<QChartView> |
|
50 | 50 | |
|
51 | 51 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
52 | 52 | |
|
53 | 53 | class ExampleWidget : public QWidget |
|
54 | 54 | \endcode |
|
55 | 55 | |
|
56 | 56 | \bold {QML project} |
|
57 | 57 | |
|
58 | 58 | Add an import line to your *.qml file: |
|
59 | 59 | \code |
|
60 |
import QtCommercial.Chart 1. |
|
|
60 | import QtCommercial.Chart 1.2 | |
|
61 | 61 | \endcode |
|
62 | 62 | |
|
63 | 63 | \raw HTML |
|
64 | 64 | \endraw |
|
65 | 65 | |
|
66 | 66 | */ |
@@ -1,93 +1,93 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2013 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #include <QApplication> |
|
22 | 22 | #include <QMainWindow> |
|
23 | 23 | #include <QChartView> |
|
24 | 24 | #include <QBarSeries> |
|
25 | 25 | #include <QBarSet> |
|
26 | 26 | #include <QLegend> |
|
27 | 27 | #include <QBarCategoryAxis> |
|
28 | 28 | |
|
29 | 29 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
30 | 30 | |
|
31 | 31 | int main(int argc, char *argv[]) |
|
32 | 32 | { |
|
33 | 33 | QApplication a(argc, argv); |
|
34 | 34 | |
|
35 | 35 | //![1] |
|
36 | 36 | QBarSet *set0 = new QBarSet("Jane"); |
|
37 | 37 | QBarSet *set1 = new QBarSet("John"); |
|
38 | 38 | QBarSet *set2 = new QBarSet("Axel"); |
|
39 | 39 | QBarSet *set3 = new QBarSet("Mary"); |
|
40 | 40 | QBarSet *set4 = new QBarSet("Samantha"); |
|
41 | 41 | |
|
42 | 42 | *set0 << 1 << 2 << 3 << 4 << 5 << 6; |
|
43 | 43 | *set1 << 5 << 0 << 0 << 4 << 0 << 7; |
|
44 | 44 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; |
|
45 | 45 | *set3 << 5 << 6 << 7 << 3 << 4 << 5; |
|
46 | 46 | *set4 << 9 << 7 << 5 << 3 << 1 << 2; |
|
47 | 47 | //![1] |
|
48 | 48 | |
|
49 | 49 | //![2] |
|
50 | 50 | QBarSeries *series = new QBarSeries(); |
|
51 | 51 | series->append(set0); |
|
52 | 52 | series->append(set1); |
|
53 | 53 | series->append(set2); |
|
54 | 54 | series->append(set3); |
|
55 | 55 | series->append(set4); |
|
56 | 56 | |
|
57 | 57 | //![2] |
|
58 | 58 | |
|
59 | 59 | //![3] |
|
60 | 60 | QChart *chart = new QChart(); |
|
61 | 61 | chart->addSeries(series); |
|
62 | 62 | chart->setTitle("Simple barchart example"); |
|
63 | 63 | chart->setAnimationOptions(QChart::SeriesAnimations); |
|
64 | 64 | //![3] |
|
65 | 65 | |
|
66 | 66 | //![4] |
|
67 | 67 | QStringList categories; |
|
68 | 68 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; |
|
69 | 69 | QBarCategoryAxis *axis = new QBarCategoryAxis(); |
|
70 | 70 | axis->append(categories); |
|
71 | 71 | chart->createDefaultAxes(); |
|
72 |
|
|
|
72 | chart->setAxisX(axis, series); | |
|
73 | 73 | //![4] |
|
74 | 74 | |
|
75 | 75 | //![5] |
|
76 | 76 | chart->legend()->setVisible(true); |
|
77 | 77 | chart->legend()->setAlignment(Qt::AlignBottom); |
|
78 | 78 | //![5] |
|
79 | 79 | |
|
80 | 80 | //![6] |
|
81 | 81 | QChartView *chartView = new QChartView(chart); |
|
82 | 82 | chartView->setRenderHint(QPainter::Antialiasing); |
|
83 | 83 | //![6] |
|
84 | 84 | |
|
85 | 85 | //![7] |
|
86 | 86 | QMainWindow window; |
|
87 | 87 | window.setCentralWidget(chartView); |
|
88 | 88 | window.resize(400, 300); |
|
89 | 89 | window.show(); |
|
90 | 90 | //![7] |
|
91 | 91 | |
|
92 | 92 | return a.exec(); |
|
93 | 93 | } |
@@ -1,80 +1,67 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2013 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #include <QApplication> |
|
22 | 22 | #include <QMainWindow> |
|
23 | 23 | #include <QChartView> |
|
24 | 24 | #include <QLineSeries> |
|
25 | 25 | |
|
26 | 26 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
27 | 27 | |
|
28 | 28 | int main(int argc, char *argv[]) |
|
29 | 29 | { |
|
30 | 30 | QApplication a(argc, argv); |
|
31 | 31 | |
|
32 | 32 | //![1] |
|
33 | 33 | QLineSeries *series = new QLineSeries(); |
|
34 | QLineSeries *series2 = new QLineSeries(); | |
|
35 | 34 | //![1] |
|
36 | 35 | |
|
37 | 36 | //![2] |
|
38 | *series << QPointF(0.06197, 0.16) | |
|
39 | << QPointF(0.18694, 0.16) | |
|
40 | << QPointF(0.3119, 0.16) | |
|
41 | << QPointF(0.43687, 0.16) | |
|
42 | << QPointF(0.56183, 0.16) | |
|
43 | << QPointF(0.68678, 0.16) | |
|
44 | << QPointF(0.81173, 0.16) | |
|
45 | << QPointF(0.93667, 0.16); | |
|
46 | ||
|
47 | *series2 << QPointF(0.06197, 0.16) | |
|
48 | << QPointF(0.18694, 0.16) | |
|
49 | << QPointF(0.3119, 0.16) | |
|
50 | << QPointF(0.43687, 0.16) | |
|
51 | << QPointF(0.56183, 0.16) | |
|
52 | << QPointF(0.68678, 0.16) | |
|
53 | << QPointF(0.81173, 0.16) | |
|
54 | << QPointF(0.93667, 0.16); | |
|
37 | series->append(0, 6); | |
|
38 | series->append(2, 4); | |
|
39 | series->append(3, 8); | |
|
40 | series->append(7, 4); | |
|
41 | series->append(10, 5); | |
|
42 | *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2); | |
|
55 | 43 | //![2] |
|
56 | 44 | |
|
57 | 45 | //![3] |
|
58 | 46 | QChart *chart = new QChart(); |
|
59 | 47 | chart->legend()->hide(); |
|
60 | 48 | chart->addSeries(series); |
|
61 | chart->addSeries(series2); | |
|
62 | 49 | chart->createDefaultAxes(); |
|
63 | 50 | chart->setTitle("Simple line chart example"); |
|
64 | 51 | //![3] |
|
65 | 52 | |
|
66 | 53 | //![4] |
|
67 | 54 | QChartView *chartView = new QChartView(chart); |
|
68 | 55 | chartView->setRenderHint(QPainter::Antialiasing); |
|
69 | 56 | //![4] |
|
70 | 57 | |
|
71 | 58 | |
|
72 | 59 | //![5] |
|
73 | 60 | QMainWindow window; |
|
74 | 61 | window.setCentralWidget(chartView); |
|
75 | 62 | window.resize(400, 300); |
|
76 | 63 | window.show(); |
|
77 | 64 | //![5] |
|
78 | 65 | |
|
79 | 66 | return a.exec(); |
|
80 | 67 | } |
General Comments 0
You need to be logged in to leave comments.
Login now