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