@@ -49,7 +49,9 public: // from QDeclarativeParserStatus | |||||
49 |
|
49 | |||
50 | public: // from QLineSeries |
|
50 | public: // from QLineSeries | |
51 | Q_INVOKABLE void append(qreal x, qreal y) { QLineSeries::append(x, y); } |
|
51 | Q_INVOKABLE void append(qreal x, qreal y) { QLineSeries::append(x, y); } | |
|
52 | Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { QLineSeries::replace(oldX, oldY, newX, newY); } | |||
52 | Q_INVOKABLE void remove(qreal x, qreal y) { QLineSeries::remove(x, y); } |
|
53 | Q_INVOKABLE void remove(qreal x, qreal y) { QLineSeries::remove(x, y); } | |
|
54 | Q_INVOKABLE void insert(int index, qreal x, qreal y) { QLineSeries::insert(index, QPointF(x, y)); } | |||
53 | Q_INVOKABLE void clear() { QLineSeries::clear(); } |
|
55 | Q_INVOKABLE void clear() { QLineSeries::clear(); } | |
54 | Q_INVOKABLE DeclarativeXyPoint *at(int index) { return DeclarativeXySeries::at(index); } |
|
56 | Q_INVOKABLE DeclarativeXyPoint *at(int index) { return DeclarativeXySeries::at(index); } | |
55 |
|
57 |
@@ -48,8 +48,10 public: // from QDeclarativeParserStatus | |||||
48 |
|
48 | |||
49 | public: // from QScatterSeries |
|
49 | public: // from QScatterSeries | |
50 | Q_INVOKABLE void append(qreal x, qreal y) { QScatterSeries::append(x, y); } |
|
50 | Q_INVOKABLE void append(qreal x, qreal y) { QScatterSeries::append(x, y); } | |
|
51 | Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { QScatterSeries::replace(oldX, oldY, newX, newY); } | |||
51 | Q_INVOKABLE void remove(qreal x, qreal y) { QScatterSeries::remove(x, y); } |
|
52 | Q_INVOKABLE void remove(qreal x, qreal y) { QScatterSeries::remove(x, y); } | |
52 | Q_INVOKABLE void clear() { QScatterSeries::clear(); } |
|
53 | Q_INVOKABLE void clear() { QScatterSeries::clear(); } | |
|
54 | Q_INVOKABLE void insert(int index, qreal x, qreal y) { QScatterSeries::insert(index, QPointF(x, y)); } | |||
53 | Q_INVOKABLE DeclarativeXyPoint *at(int index) { return DeclarativeXySeries::at(index); } |
|
55 | Q_INVOKABLE DeclarativeXyPoint *at(int index) { return DeclarativeXySeries::at(index); } | |
54 |
|
56 | |||
55 | Q_SIGNALS: |
|
57 | Q_SIGNALS: |
@@ -34,6 +34,7 class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries | |||||
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | Q_INTERFACES(QDeclarativeParserStatus) |
|
36 | Q_INTERFACES(QDeclarativeParserStatus) | |
|
37 | Q_PROPERTY(int count READ count NOTIFY countChanged) | |||
37 | Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren) |
|
38 | Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren) | |
38 | Q_CLASSINFO("DefaultProperty", "declarativeChildren") |
|
39 | Q_CLASSINFO("DefaultProperty", "declarativeChildren") | |
39 |
|
40 | |||
@@ -48,8 +49,10 public: // from QDeclarativeParserStatus | |||||
48 |
|
49 | |||
49 | public: // from QSplineSeries |
|
50 | public: // from QSplineSeries | |
50 | Q_INVOKABLE void append(qreal x, qreal y) { QSplineSeries::append(x, y); } |
|
51 | Q_INVOKABLE void append(qreal x, qreal y) { QSplineSeries::append(x, y); } | |
|
52 | Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { QSplineSeries::replace(oldX, oldY, newX, newY); } | |||
51 | Q_INVOKABLE void remove(qreal x, qreal y) { QSplineSeries::remove(x, y); } |
|
53 | Q_INVOKABLE void remove(qreal x, qreal y) { QSplineSeries::remove(x, y); } | |
52 | Q_INVOKABLE void clear() { QSplineSeries::clear(); } |
|
54 | Q_INVOKABLE void clear() { QSplineSeries::clear(); } | |
|
55 | Q_INVOKABLE void insert(int index, qreal x, qreal y) { QSplineSeries::insert(index, QPointF(x, y)); } | |||
53 | Q_INVOKABLE DeclarativeXyPoint *at(int index) { return DeclarativeXySeries::at(index); } |
|
56 | Q_INVOKABLE DeclarativeXyPoint *at(int index) { return DeclarativeXySeries::at(index); } | |
54 |
|
57 | |||
55 | Q_SIGNALS: |
|
58 | Q_SIGNALS: |
@@ -43,7 +43,7 ChartView { | |||||
43 | onClicked: console.log("lineSeries.onClicked: " + point.x + ", " + point.y); |
|
43 | onClicked: console.log("lineSeries.onClicked: " + point.x + ", " + point.y); | |
44 | onPointReplaced: console.log("lineSeries.onPointReplaced: " + index); |
|
44 | onPointReplaced: console.log("lineSeries.onPointReplaced: " + index); | |
45 | onPointRemoved: console.log("lineSeries.onPointRemoved: " + index); |
|
45 | onPointRemoved: console.log("lineSeries.onPointRemoved: " + index); | |
46 | onPointAdded: console.log("lineSeries.onPointAdded: " + index); |
|
46 | onPointAdded: console.log("lineSeries.onPointAdded: " + series.at(index).x + ", " + series.at(index).y); | |
47 | onColorChanged: console.log("lineSeries.onColorChanged: " + color); |
|
47 | onColorChanged: console.log("lineSeries.onColorChanged: " + color); | |
48 | onCountChanged: console.log("lineSeries.onCountChanged: " + count); |
|
48 | onCountChanged: console.log("lineSeries.onCountChanged: " + count); | |
49 | } |
|
49 | } |
@@ -38,6 +38,29 Flow { | |||||
38 | } |
|
38 | } | |
39 | Button { |
|
39 | Button { | |
40 | text: "points visible" |
|
40 | text: "points visible" | |
41 | onClicked: series.pointsVisible = !series.pointsVisible |
|
41 | onClicked: series.pointsVisible = !series.pointsVisible; | |
|
42 | } | |||
|
43 | Button { | |||
|
44 | text: "append point" | |||
|
45 | onClicked: series.append(series.count - 1, series.count - 1); | |||
|
46 | } | |||
|
47 | Button { | |||
|
48 | text: "replace point" | |||
|
49 | onClicked: { | |||
|
50 | var xyPoint = series.at(series.count - 1); | |||
|
51 | series.replace(xyPoint.x, xyPoint.y, xyPoint.x, xyPoint.y + 0.1); | |||
|
52 | } | |||
|
53 | } | |||
|
54 | Button { | |||
|
55 | text: "remove point" | |||
|
56 | onClicked: series.remove(series.at(series.count - 1).x, series.at(series.count - 1).y); | |||
|
57 | } | |||
|
58 | Button { | |||
|
59 | text: "insert point" | |||
|
60 | onClicked: series.insert(0, series.count - 1, series.count - 1); | |||
|
61 | } | |||
|
62 | Button { | |||
|
63 | text: "clear" | |||
|
64 | onClicked: series.clear(); | |||
42 | } |
|
65 | } | |
43 | } |
|
66 | } |
@@ -40,6 +40,9 ChartView { | |||||
40 |
|
40 | |||
41 | onNameChanged: console.log("scatterSeries.onNameChanged: " + name); |
|
41 | onNameChanged: console.log("scatterSeries.onNameChanged: " + name); | |
42 | onVisibleChanged: console.log("scatterSeries.onVisibleChanged: " + visible); |
|
42 | onVisibleChanged: console.log("scatterSeries.onVisibleChanged: " + visible); | |
|
43 | onPointReplaced: console.log("scatterSeries.onPointReplaced: " + index); | |||
|
44 | onPointRemoved: console.log("scatterSeries.onPointRemoved: " + index); | |||
|
45 | onPointAdded: console.log("scatterSeries.onPointAdded: " + series.at(index).x + ", " + series.at(index).y); | |||
43 | onColorChanged: console.log("scatterSeries.onColorChanged: " + color); |
|
46 | onColorChanged: console.log("scatterSeries.onColorChanged: " + color); | |
44 | onBorderColorChanged: console.log("scatterSeries.onBorderColorChanged: " + borderColor); |
|
47 | onBorderColorChanged: console.log("scatterSeries.onBorderColorChanged: " + borderColor); | |
45 | onCountChanged: console.log("scatterSeries.onCountChanged: " + count); |
|
48 | onCountChanged: console.log("scatterSeries.onCountChanged: " + count); |
@@ -52,4 +52,27 Flow { | |||||
52 | text: "markerShape" |
|
52 | text: "markerShape" | |
53 | onClicked: series.markerShape = ((series.markerShape + 1) % 2); |
|
53 | onClicked: series.markerShape = ((series.markerShape + 1) % 2); | |
54 | } |
|
54 | } | |
|
55 | Button { | |||
|
56 | text: "append point" | |||
|
57 | onClicked: series.append(series.count - 1, series.count - 1); | |||
|
58 | } | |||
|
59 | Button { | |||
|
60 | text: "replace point" | |||
|
61 | onClicked: { | |||
|
62 | var xyPoint = series.at(series.count - 1); | |||
|
63 | series.replace(xyPoint.x, xyPoint.y, xyPoint.x, xyPoint.y + 0.1); | |||
|
64 | } | |||
|
65 | } | |||
|
66 | Button { | |||
|
67 | text: "remove point" | |||
|
68 | onClicked: series.remove(series.at(series.count - 1).x, series.at(series.count - 1).y); | |||
|
69 | } | |||
|
70 | Button { | |||
|
71 | text: "insert point" | |||
|
72 | onClicked: series.insert(0, series.count - 1, series.count - 1); | |||
|
73 | } | |||
|
74 | Button { | |||
|
75 | text: "clear" | |||
|
76 | onClicked: series.clear(); | |||
|
77 | } | |||
55 | } |
|
78 | } |
@@ -42,7 +42,7 ChartView { | |||||
42 | onClicked: console.log("splineSeries.onClicked: " + point.x + ", " + point.y); |
|
42 | onClicked: console.log("splineSeries.onClicked: " + point.x + ", " + point.y); | |
43 | onPointReplaced: console.log("splineSeries.onPointReplaced: " + index); |
|
43 | onPointReplaced: console.log("splineSeries.onPointReplaced: " + index); | |
44 | onPointRemoved: console.log("splineSeries.onPointRemoved: " + index); |
|
44 | onPointRemoved: console.log("splineSeries.onPointRemoved: " + index); | |
45 | onPointAdded: console.log("splineSeries.onPointAdded: " + index); |
|
45 | onPointAdded: console.log("splineSeries.onPointAdded: " + series.at(index).x + ", " + series.at(index).y); | |
46 | onColorChanged: console.log("splineSeries.onColorChanged: " + color); |
|
46 | onColorChanged: console.log("splineSeries.onColorChanged: " + color); | |
47 | onCountChanged: console.log("splineSeries.onCountChanged: " + count); |
|
47 | onCountChanged: console.log("splineSeries.onCountChanged: " + count); | |
48 | } |
|
48 | } |
General Comments 0
You need to be logged in to leave comments.
Login now