|
@@
-14,10
+14,9
int main(int argc, char *argv[])
|
|
14
|
14
|
// Create chart view
|
|
15
|
15
|
QChartView *chartView = new QChartView();
|
|
16
|
16
|
chartView->setRenderHint(QPainter::Antialiasing);
|
|
17
|
|
chartView->setChartTheme(QChart::ChartThemeScientific);
|
|
18
|
17
|
// Add scatter series with linear test data with random "noise"
|
|
19
|
18
|
QScatterSeries *scatter = new QScatterSeries();
|
|
20
|
|
for (qreal i(0.0); i < 20; i += 0.25) {
|
|
|
19
|
for (qreal i(0.0); i < 20; i += 0.5) {
|
|
21
|
20
|
qreal x = i + (qreal)(rand() % 100) / 100.0;
|
|
22
|
21
|
qreal y = i + (qreal)(rand() % 100) / 100.0;
|
|
23
|
22
|
(*scatter) << QPointF(x, y);
|
|
@@
-28,7
+27,7
int main(int argc, char *argv[])
|
|
28
|
27
|
|
|
29
|
28
|
// And more
|
|
30
|
29
|
//! [2]
|
|
31
|
|
//*scatter << QPointF(2.0, 5.5) << QPointF(2.2, 5.4);
|
|
|
30
|
*scatter << QPointF(2.0, 5.5) << QPointF(2.2, 5.4);
|
|
32
|
31
|
//! [2]
|
|
33
|
32
|
|
|
34
|
33
|
//! [3]
|
|
@@
-37,7
+36,7
int main(int argc, char *argv[])
|
|
37
|
36
|
QPen pen(QColor(0, 255, 0, 60), 3);
|
|
38
|
37
|
scatter->setPen(pen);
|
|
39
|
38
|
scatter->setShape(QScatterSeries::MarkerShapeRectangle);
|
|
40
|
|
scatter->setSize(15.0);
|
|
|
39
|
scatter->setSize(25.0);
|
|
41
|
40
|
//! [3]
|
|
42
|
41
|
|
|
43
|
42
|
// Use the chart widget as the central widget
|