##// END OF EJS Templates
Update scatter example and docs
Michal Klocek -
r471:b6db000cfc58
parent child
Show More
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,26
1 /*!
2 \example example/scatterchart
3 \title ScatterChart Example
4 \subtitle
5
6 The example shows how to create simple scatter chart.
7
8 \image scatterchart.png
9
10 To create scatter charts, QScatterSeries instance is needed. Here we create scatter series instance and we set the type, color and width of outline for scatter points.
11
12 \snippet ../example/scatterchart/main.cpp 1
13
14 We add data to be shown. We can use add() member function or use stream operator.
15
16 \snippet ../example/scatterchart/main.cpp 2
17
18 In the end we create QChartView instance, set title, set anti-aliasing and add scatter series.
19
20 \snippet ../example/scatterchart/main.cpp 3
21
22 Chart is ready to be shown.
23
24 \snippet ../example/scatterchart/main.cpp 4
25
26 */ No newline at end of file
@@ -1,30 +1,31
1 /*!
1 /*!
2 \page examples.html
2 \page examples.html
3 \title Examples
3 \title Examples
4 \keyword Examples
4 \keyword Examples
5
5
6 \raw HTML
6 \raw HTML
7 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
7 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
8 <tr>
8 <tr>
9 <th class="titleheader" width="33%">
9 <th class="titleheader" width="33%">
10 List of examples
10 List of examples
11 </th>
11 </th>
12 </tr>
12 </tr>
13 <tr>
13 <tr>
14 <td valign="top">
14 <td valign="top">
15 <ul>
15 <ul>
16 <li><a href="example-areachart.html">Area Chart example</a></li>
16 <li><a href="example-areachart.html">Area Chart example</a></li>
17 <li><a href="example-barchart.html">Bar Chart example</a></li>
17 <li><a href="example-barchart.html">Bar Chart example</a></li>
18 <li><a href="example-stackedbarchart.html">Stacked Bar Chart example</a></li>
18 <li><a href="example-stackedbarchart.html">Stacked Bar Chart example</a></li>
19 <li><a href="example-percentbarchart.html">Percent Bar Chart example</a></li>
19 <li><a href="example-percentbarchart.html">Percent Bar Chart example</a></li>
20 <li><a href="example-scatterchart.html">Scatter Chart example</a></li>
20 <li><a href="example-stackedbarchartdrilldown.html">Stacked Bar Chart Drilldown example</a></li>
21 <li><a href="example-stackedbarchartdrilldown.html">Stacked Bar Chart Drilldown example</a></li>
21 <li><a href="example-linechart.html">Line Chart example</a></li>
22 <li><a href="example-linechart.html">Line Chart example</a></li>
22 <li><a href="example-piechart.html">Pie Chart example</a></li>
23 <li><a href="example-piechart.html">Pie Chart example</a></li>
23 <li><a href="example-gdpbarchart.html">GDP Chart example</a></li>
24 <li><a href="example-gdpbarchart.html">GDP Chart example</a></li>
24 <li><a href="example-splinechart.html">Spline Chart example</a></li>
25 <li><a href="example-splinechart.html">Spline Chart example</a></li>
25 </ul>
26 </ul>
26 </td>
27 </td>
27 </tr>
28 </tr>
28 </table>
29 </table>
29 \endraw
30 \endraw
30 */
31 */
@@ -1,41 +1,44
1 /*!
1 /*!
2 \page index.html
2 \page index.html
3 \keyword About
3 \keyword About
4
4
5 \raw HTML
5 \raw HTML
6 <div class="qchart">
6 <div class="qchart">
7 <img src="images/qt_commercial_logo.png" alt="qtcommercial"/>
7 <img src="images/qt_commercial_logo.png" alt="qtcommercial"/>
8
8
9 <p>
9 <p>
10 QCharts is a part of Qt Commercial addons package. It provides a set of easy to use chart
10 QCharts is a part of Qt Commercial addons package. It provides a set of easy to use chart
11 components which are available for Qt Commercial customers. It uses Qt Graphics View
11 components which are available for Qt Commercial customers. It uses Qt Graphics View
12 Framework, therefore charts can be easily integrated to modern 2D user interfaces. QCharts can
12 Framework, therefore charts can be easily integrated to modern 2D user interfaces. QCharts can
13 be used as QWidgets, QGraphicsWidget or QML elements. Users can easily create impressive
13 be used as QWidgets, QGraphicsWidget or QML elements. Users can easily create impressive
14 graphs by selecting one of the charts themes.
14 graphs by selecting one of the charts themes.
15 </p>
15 </p>
16
16
17 <table><tr>
17 <table><tr>
18 <td><a href="example-linechart.html"><img src="images/linechart.png" alt="linechart" /></a></td>
18 <td><a href="example-linechart.html"><img src="images/linechart.png" alt="linechart" /></a></td>
19 <td><a href="example-areachart.html"><img src="images/areachart.png" alt="areachart" /></a></td>
19 <td><a href="example-areachart.html"><img src="images/areachart.png" alt="areachart" /></a></td>
20 </tr>
20 </tr>
21 <tr>
21 <tr>
22 <td><a href="example-scatterchart.html"><img src="images/scatterchart.png" alt="scatterchart" /></a></td>
22 <td><a href="example-barchart.html"><img src="images/barchart.png" alt="barchart" /></a></td>
23 <td><a href="example-barchart.html"><img src="images/barchart.png" alt="barchart" /></a></td>
23 <td><a href="example-percentbarchart.html"><img src="images/percentbarchart.png" alt="percentbarcchart" /></a></td>
24 </tr>
24 </tr>
25 <tr>
25 <tr>
26 <td><a href="example-stackedbarchart.html"><img src="images/stackedbarchart.png" alt="stackedbarchart" /></a></td>
26 <td><a href="example-stackedbarchart.html"><img src="images/stackedbarchart.png" alt="stackedbarchart" /></a></td>
27 <td><img src="images/chartview_example.jpg " alt="linechart" /></td>
27 <td><a href="example-percentbarchart.html"><img src="images/percentbarchart.png" alt="percentbarcchart" /></a></td>
28 </tr><tr>
28 </tr><tr>
29 <td><img src="images/chartview_example_scatter.jpg " alt="scatterchart" /></td>
29 <td><img src="images/chartview_example_scatter.jpg " alt="scatterchart" /></td>
30 <td><img src="images/chartview_example_theme.jpg " alt="themechart" /></td>
30 <td><img src="images/chartview_example_theme.jpg " alt="themechart" /></td>
31 </tr>
31 </tr>
32 <tr>
32 <tr>
33 <td><img src="images/chartview_example_bar.jpg " alt="barchart" /></td>
33 <td><img src="images/chartview_example_bar.jpg " alt="barchart" /></td>
34 <td><img src="images/chartview_example_pie.jpg " alt="piechart" /></td>
34 <td><img src="images/chartview_example_pie.jpg " alt="piechart" /></td>
35 </tr>
35 </tr>
36 <tr>
37 <td><img src="images/chartview_example.jpg " alt="linechart" /></td>
38 </tr>
36 </table>
39 </table>
37 </div>
40 </div>
38 \endraw
41 \endraw
39
42
40
43
41 */
44 */
@@ -1,21 +1,21
1 TEMPLATE = subdirs
1 TEMPLATE = subdirs
2 SUBDIRS += linechart \
2 SUBDIRS += linechart \
3 zoomlinechart \
3 zoomlinechart \
4 colorlinechart \
4 colorlinechart \
5 barchart \
5 barchart \
6 stackedbarchart \
6 stackedbarchart \
7 percentbarchart \
7 percentbarchart \
8 scatter \
8 scatterchart \
9 piechart \
9 piechart \
10 piechartcustomization \
10 piechartcustomization \
11 piechartdrilldown \
11 piechartdrilldown \
12 dynamiclinechart \
12 dynamiclinechart \
13 axischart \
13 axischart \
14 multichart \
14 multichart \
15 gdpbarchart \
15 gdpbarchart \
16 presenterchart \
16 presenterchart \
17 chartview \
17 chartview \
18 scatterinteractions \
18 scatterinteractions \
19 splinechart \
19 splinechart \
20 areachart \
20 areachart \
21 stackedbarchartdrilldown
21 stackedbarchartdrilldown
@@ -1,51 +1,49
1 #include <QtGui/QApplication>
1 #include <QtGui/QApplication>
2 #include <QMainWindow>
2 #include <QMainWindow>
3 #include <qchartglobal.h>
3 #include <qchartglobal.h>
4 #include <qchartview.h>
4 #include <qchartview.h>
5 #include <qscatterseries.h>
5 #include <qscatterseries.h>
6
6
7 QTCOMMERCIALCHART_USE_NAMESPACE
7 QTCOMMERCIALCHART_USE_NAMESPACE
8
8
9 int main(int argc, char *argv[])
9 int main(int argc, char *argv[])
10 {
10 {
11 QApplication a(argc, argv);
11 QApplication a(argc, argv);
12
12
13 //! [1]
13 //! [1]
14 // Create chart view
15 QChartView *chartView = new QChartView();
16 chartView->setRenderHint(QPainter::Antialiasing);
17 // Add scatter series with linear test data with random "noise"
18 QScatterSeries *scatter = new QScatterSeries();
14 QScatterSeries *scatter = new QScatterSeries();
19 for (qreal i(0.0); i < 20; i += 0.5) {
20 qreal x = i + (qreal)(rand() % 100) / 100.0;
21 qreal y = i + (qreal)(rand() % 100) / 100.0;
22 (*scatter) << QPointF(x, y);
23 }
24 // Chart takes ownership
25 chartView->addSeries(scatter);
26 //! [1]
27
15
28 // And more
29 //! [2]
30 // *scatter << QPointF(2.0, 5.5) << QPointF(2.2, 5.4);
31 //! [2]
32
33 //! [3]
34 QBrush brush(Qt::red);
16 QBrush brush(Qt::red);
35 scatter->setBrush(brush);
36 QPen pen(Qt::black);
17 QPen pen(Qt::black);
37 pen.setWidth(3);
18 pen.setWidth(2);
19
38 scatter->setPen(pen);
20 scatter->setPen(pen);
21 scatter->setBrush(brush);
39 scatter->setShape(QScatterSeries::MarkerShapeCircle);
22 scatter->setShape(QScatterSeries::MarkerShapeCircle);
40 scatter->setSize(25.0);
23 scatter->setSize(15.0);
41 //! [3]
24 //! [1]
25
26 //! [2]
27 for (qreal i(0.0); i < 20; i += 0.5) {
28 qreal x = i + (qreal) (rand() % 100) / 100.0;
29 qreal y = i + (qreal) (rand() % 100) / 100.0;
30 scatter->add(x, y);
31 }
32 *scatter << QPointF(2.0, 5.5) << QPointF(2.2, 5.4);
33 //! [2]
42
34
43 // Use the chart widget as the central widget
35 //! [3]
44 QMainWindow w;
36 QMainWindow window;
45 w.resize(400, 300);
37 QChartView *chartView = new QChartView(&window);
46 w.setCentralWidget(chartView);
38 chartView->setRenderHint(QPainter::Antialiasing);
47 // w.setWindowFlags(Qt::FramelessWindowHint);
39 chartView->setChartTitle("Basic scatter chart example");
48 w.show();
40 chartView->addSeries(scatter);
41 //! [3]
49
42
43 //! [4]
44 window.setCentralWidget(chartView);
45 window.resize(400, 300);
46 window.show();
47 //! [4]
50 return a.exec();
48 return a.exec();
51 }
49 }
@@ -1,5 +1,5
1 !include( ../example.pri ) {
1 !include( ../example.pri ) {
2 error( "Couldn't find the example.pri file!" )
2 error( "Couldn't find the example.pri file!" )
3 }
3 }
4 TARGET = scatter
4 TARGET = scatterchart
5 SOURCES += main.cpp
5 SOURCES += main.cpp
General Comments 0
You need to be logged in to leave comments. Login now