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