@@ -17,7 +17,7 | |||||
17 | ****************************************************************************/ |
|
17 | ****************************************************************************/ | |
18 |
|
18 | |||
19 | import QtQuick 2.0 |
|
19 | import QtQuick 2.0 | |
20 |
import QtCharts 2. |
|
20 | import QtCharts 2.1 | |
21 |
|
21 | |||
22 | Flow { |
|
22 | Flow { | |
23 | anchors.fill: parent |
|
23 | anchors.fill: parent | |
@@ -27,15 +27,23 Flow { | |||||
27 |
|
27 | |||
28 | Button { |
|
28 | Button { | |
29 | text: "add line" |
|
29 | text: "add line" | |
30 | onClicked: addXYSeries(ChartView.SeriesTypeLine, "line"); |
|
30 | onClicked: addXYSeries(ChartView.SeriesTypeLine, "line", false); | |
|
31 | } | |||
|
32 | Button { | |||
|
33 | text: "add GL line" | |||
|
34 | onClicked: addXYSeries(ChartView.SeriesTypeLine, "GL line", true); | |||
31 | } |
|
35 | } | |
32 | Button { |
|
36 | Button { | |
33 | text: "add spline" |
|
37 | text: "add spline" | |
34 | onClicked: addXYSeries(ChartView.SeriesTypeSpline, "spline"); |
|
38 | onClicked: addXYSeries(ChartView.SeriesTypeSpline, "spline", false); | |
35 | } |
|
39 | } | |
36 | Button { |
|
40 | Button { | |
37 | text: "add scatter" |
|
41 | text: "add scatter" | |
38 | onClicked: addXYSeries(ChartView.SeriesTypeScatter, "scatter"); |
|
42 | onClicked: addXYSeries(ChartView.SeriesTypeScatter, "scatter", false); | |
|
43 | } | |||
|
44 | Button { | |||
|
45 | text: "add GL scatter" | |||
|
46 | onClicked: addXYSeries(ChartView.SeriesTypeScatter, "GL scatter", true); | |||
39 | } |
|
47 | } | |
40 | Button { |
|
48 | Button { | |
41 | text: "remove last" |
|
49 | text: "remove last" | |
@@ -51,11 +59,16 Flow { | |||||
51 | onClicked: chart.removeAllSeries(); |
|
59 | onClicked: chart.removeAllSeries(); | |
52 | } |
|
60 | } | |
53 |
|
61 | |||
54 | function addXYSeries(type, name) { |
|
62 | function addXYSeries(type, name, openGl) { | |
55 | var series = chart.createSeries(type, name + " " + chart.count); |
|
63 | var series = chart.createSeries(type, name + " " + chart.count); | |
56 | for (var i = chart.axisX().min; i < chart.axisX().max; i++) { |
|
64 | var multiplier = 10; | |
|
65 | if (openGl) { | |||
|
66 | series.useOpenGL = true; | |||
|
67 | multiplier = 100; | |||
|
68 | } | |||
|
69 | for (var i = chart.axisX().min * multiplier; i < chart.axisX().max * multiplier; i++) { | |||
57 | var y = Math.random() * (chart.axisY().max - chart.axisY().min) + chart.axisY().min; |
|
70 | var y = Math.random() * (chart.axisY().max - chart.axisY().min) + chart.axisY().min; | |
58 | var x = Math.random() + i; |
|
71 | var x = (Math.random() + i) / multiplier; | |
59 | series.append(x, y); |
|
72 | series.append(x, y); | |
60 | } |
|
73 | } | |
61 | } |
|
74 | } |
General Comments 0
You need to be logged in to leave comments.
Login now