##// END OF EJS Templates
QML api pie slice added/removed signals
Tero Ahola -
r1503:873325dbfe57
parent child
Show More
@@ -30,6 +30,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 30 DeclarativePieSeries::DeclarativePieSeries(QObject *parent) :
31 31 QPieSeries(parent)
32 32 {
33 connect(this, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleAdded(QList<QPieSlice*>)));
34 connect(this, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleRemoved(QList<QPieSlice*>)));
33 35 }
34 36
35 37 void DeclarativePieSeries::classBegin()
@@ -66,7 +68,7 void DeclarativePieSeries::appendSeriesChildren(QDeclarativeListProperty<QObject
66 68 QPieSlice *DeclarativePieSeries::at(int index)
67 69 {
68 70 QList<QPieSlice*> sliceList = slices();
69 if (index < sliceList.count())
71 if (index >= 0 && index < sliceList.count())
70 72 return sliceList[index];
71 73
72 74 return 0;
@@ -91,6 +93,31 QPieSlice* DeclarativePieSeries::append(QString label, qreal value)
91 93 return slice;
92 94 }
93 95
96 bool DeclarativePieSeries::remove(int index)
97 {
98 QPieSlice *slice = at(index);
99 if (slice)
100 return QPieSeries::remove(slice);
101 return false;
102 }
103
104 void DeclarativePieSeries::clear()
105 {
106 QPieSeries::clear();
107 }
108
109 void DeclarativePieSeries::handleAdded(QList<QPieSlice*> slices)
110 {
111 foreach(QPieSlice *slice, slices)
112 emit sliceAdded(slice);
113 }
114
115 void DeclarativePieSeries::handleRemoved(QList<QPieSlice*> slices)
116 {
117 foreach(QPieSlice *slice, slices)
118 emit sliceRemoved(slice);
119 }
120
94 121 #include "moc_declarativepieseries.cpp"
95 122
96 123 QTCOMMERCIALCHART_END_NAMESPACE
@@ -45,13 +45,21 public:
45 45 Q_INVOKABLE QPieSlice *at(int index);
46 46 Q_INVOKABLE QPieSlice *find(QString label);
47 47 Q_INVOKABLE QPieSlice *append(QString label, qreal value);
48 Q_INVOKABLE bool remove(int index);
49 Q_INVOKABLE void clear();
48 50
49 51 public:
50 52 void classBegin();
51 53 void componentComplete();
52 54
55 Q_SIGNALS:
56 void sliceAdded(QPieSlice* slice);
57 void sliceRemoved(QPieSlice* slice);
58
53 59 public Q_SLOTS:
54 60 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
61 void handleAdded(QList<QPieSlice*> slices);
62 void handleRemoved(QList<QPieSlice*> slices);
55 63 };
56 64
57 65 QTCOMMERCIALCHART_END_NAMESPACE
@@ -172,14 +172,20 QTCOMMERCIALCHART_BEGIN_NAMESPACE
172 172
173 173 \sa append(), insert()
174 174 */
175 /*!
176 \qmlsignal PieSeries::added(PieSlice slice)
177 Emitted when \a slice has been added to the series.
178 */
175 179
176 180 /*!
177 181 \fn void QPieSeries::removed(QList<QPieSlice*> slices)
178
179 182 This signal is emitted when \a slices have been removed from the series.
180
181 183 \sa remove()
182 184 */
185 /*!
186 \qmlsignal PieSeries::removed(PieSlice slice)
187 Emitted when \a slice has been removed from the series.
188 */
183 189
184 190 /*!
185 191 \fn void QPieSeries::clicked(QPieSlice* slice)
@@ -27,13 +27,11 ChartView {
27 27 axisXLabels: ["0", "2000", "1", "2001", "2", "2002", "3", "2003", "4", "2004", "5", "2005",
28 28 "6", "2006", "7", "2007", "8", "2008", "9", "2009", "10", "2010", "11", "2011"]
29 29
30 property variant series: daSeries
30 property variant series: areaSeries
31 31
32 32 AreaSeries {
33 id: daSeries
33 id: areaSeries
34 34 name: "area 1"
35 onSelected: console.log("areaSeries.onSelected");
36 onClicked: console.log("areaSeries.onClicked: " + point.x + ", " + point.y);
37 35 upperSeries: LineSeries {
38 36 XyPoint { x: 0; y: 1 }
39 37 XyPoint { x: 1; y: 1 }
@@ -62,5 +60,13 ChartView {
62 60 XyPoint { x: 10; y: 0 }
63 61 XyPoint { x: 11; y: 0 }
64 62 }
63
64 onNameChanged: console.log("areaSeries.onNameChanged: " + name);
65 onVisibleChanged: console.log("areaSeries.onVisibleChanged: " + visible);
66 onClicked: console.log("areaSeries.onClicked: " + point.x + ", " + point.y);
67 onSelected: console.log("areaSeries.onSelected");
68 onColorChanged: console.log("areaSeries.onColorChanged: " + color);
69 onBorderColorChanged: console.log("areaSeries.onBorderColorChanged: " + borderColor);
70 // onCountChanged: console.log("areaSeries.onCountChanged: " + count);
65 71 }
66 72 }
@@ -28,24 +28,6 Flow {
28 28 flow: Flow.TopToBottom
29 29 property variant series
30 30
31 onSeriesChanged: {
32 if (series && series.name == "area 1") {
33 seriesConnections.target = series;
34 } else {
35 seriesConnections.target = null;
36 }
37 }
38
39 Connections {
40 id: seriesConnections
41 target: null
42 onNameChanged: console.log("series.onNameChanged: " + series.name);
43 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
44 onColorChanged: console.log("series.onColorChanged: " + series.color);
45 onBorderColorChanged: console.log("series.onBorderColorChanged: " + series.borderColor);
46 onCountChanged: console.log("series.onCountChanged: " + series.count);
47 }
48
49 31 Button {
50 32 text: "visible"
51 33 onClicked: series.visible = !series.visible;
@@ -28,18 +28,27 ChartView {
28 28 legend.alignment: Qt.AlignBottom
29 29 axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"]
30 30
31 property variant series: daSeries
31 property variant series: barSeries
32 32
33 33 BarSeries {
34 id: daSeries
34 id: barSeries
35 35 name: "bar"
36 onClicked: console.log("onClicked: " + barset + " " + index);
37 onHovered: console.log("onHovered: " + barset + " " + status);
38 36 BarSet { label: "Bob"; values: [4, 7, 3, 10, 5, 6]
39 37 onClicked: console.log("barset.onClicked: " + index);
40 38 onHovered: console.log("barset.onHovered: " + status);
39 onColorChanged: console.log("barset.onColorChanged: " + color);
40 onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color);
41 onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color);
42 onCountChanged: console.log("barset.onCountChanged: " + count);
41 43 }
42 44 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 8] }
43 45 BarSet { label: "James"; values: [3, 5, 8, 5, 4, 7] }
46
47 onNameChanged: console.log("barSeries.onNameChanged: " + series.name);
48 onVisibleChanged: console.log("barSeries.onVisibleChanged: " + series.visible);
49 onClicked: console.log("barSeries.onClicked: " + barset + " " + index);
50 onHovered: console.log("barSeries.onHovered: " + barset + " " + status);
51 onLabelsVisibleChanged: console.log("barSeries.onLabelsVisibleChanged: " + series.labelsVisible);
52 onCountChanged: console.log("barSeries.onCountChanged: " + count);
44 53 }
45 54 }
@@ -27,34 +27,6 Flow {
27 27 flow: Flow.TopToBottom
28 28 property variant series
29 29
30 onSeriesChanged: {
31 if (series && series.name == "bar") {
32 seriesConnections.target = series;
33 setConnections.target = series.at(0);
34 } else {
35 seriesConnections.target = null;
36 setConnections.target = null;
37 }
38 }
39
40 Connections {
41 id: seriesConnections
42 target: null
43 onNameChanged: console.log("series.onNameChanged: " + series.name);
44 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
45 onLabelsVisibleChanged: console.log("series.onLabelsVisibleChanged: " + series.labelsVisible);
46 onCountChanged: console.log("series.onCountChanged: " + count);
47 }
48
49 Connections {
50 id: setConnections
51 target: null
52 onColorChanged: console.log("series.onColorChanged: " + color);
53 onBorderColorChanged: console.log("series.onBorderColorChanged: " + color);
54 onLabelColorChanged: console.log("series.onLabelColorChanged: " + color);
55 onCountChanged: console.log("series.onCountChanged: " + count);
56 }
57
58 30 Button {
59 31 text: "visible"
60 32 onClicked: series.visible = !series.visible;
@@ -37,4 +37,36 ChartView {
37 37 XyPoint { x: 3.4; y: 3.0 }
38 38 XyPoint { x: 4.1; y: 3.3 }
39 39 }
40
41 onVisibleChanged: console.log("chart.onVisibleChanged: " + series.visible);
42 onTitleColorChanged: console.log("chart.onTitleColorChanged: " + series.titleColor);
43 onBackgroundColorChanged: console.log("chart.onBackgroundColorChanged: " + series.backgroundColor);
44 onDropShadowEnabledChanged: console.log("chart.onDropShadowEnabledChanged: " + enabled);
45
46 legend.onVisibleChanged: console.log("legend.onVisibleChanged: " + series.legend.visible);
47 legend.onBackgroundVisibleChanged: console.log("legend.onBackgroundVisibleChanged: " + visible);
48 legend.onColorChanged: console.log("legend.onColorChanged: " + color);
49 legend.onBorderColorChanged: console.log("legend.onBorderColorChanged: " + color);
50
51 axisX.onColorChanged: console.log("axisX.onColorChanged: " + color);
52 axisX.onLabelsVisibleChanged: console.log("axisX.onLabelsVisibleChanged: " + visible);
53 axisX.onLabelsColorChanged: console.log("axisX.onLabelsColorChanged: " + color);
54 axisX.onVisibleChanged: console.log("axisX.onVisibleChanged: " + visible);
55 axisX.onGridVisibleChanged: console.log("axisX.onGridVisibleChanged: " + visible);
56 axisX.onShadesVisibleChanged: console.log("axisX.onShadesVisibleChanged: " + visible);
57 axisX.onShadesColorChanged: console.log("axisX.onShadesColorChanged: " + color);
58 axisX.onShadesBorderColorChanged: console.log("axisX.onShadesBorderColorChanged: " + color);
59 axisX.onMinChanged: console.log("axisX.onMinChanged: " + min);
60 axisX.onMaxChanged: console.log("axisX.onMaxChanged: " + max);
61
62 axisY.onColorChanged: console.log("axisY.onColorChanged: " + color);
63 axisY.onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible);
64 axisY.onLabelsColorChanged: console.log("axisY.onLabelsColorChanged: " + color);
65 axisY.onVisibleChanged: console.log("axisY.onVisibleChanged: " + visible);
66 axisY.onGridVisibleChanged: console.log("axisY.onGridVisibleChanged: " + visible);
67 axisY.onShadesVisibleChanged: console.log("axisY.onShadesVisibleChanged: " + visible);
68 axisY.onShadesColorChanged: console.log("axisY.onShadesColorChanged: " + color);
69 axisY.onShadesBorderColorChanged: console.log("axisY.onShadesBorderColorChanged: " + color);
70 axisY.onMinChanged: console.log("axisY.onMinChanged: " + min);
71 axisY.onMaxChanged: console.log("axisY.onMaxChanged: " + max);
40 72 }
@@ -28,67 +28,6 Flow {
28 28 flow: Flow.TopToBottom
29 29 property variant series // TODO: rename to chart
30 30
31 onSeriesChanged: {
32 if (series && series.name == "") {
33 chartConnections.target = series;
34 legendConnections.target = series.legend;
35 axisXConnections.target = series.axisX;
36 axisYConnections.target = series.axisY;
37 } else {
38 legendConnections.target = null;
39 axisXConnections.target = null;
40 axisYConnections.target = null;
41 }
42 }
43
44 Connections {
45 id: chartConnections
46 target: null
47 onVisibleChanged: console.log("chart.onVisibleChanged: " + series.visible);
48 onTitleColorChanged: console.log("chart.onTitleColorChanged: " + series.titleColor);
49 onBackgroundColorChanged: console.log("chart.onBackgroundColorChanged: " + series.backgroundColor);
50 onDropShadowEnabledChanged: console.log("chart.onDropShadowEnabledChanged: " + enabled);
51 }
52
53 Connections {
54 id: legendConnections
55 target: null
56 onVisibleChanged: console.log("legend.onVisibleChanged: " + series.legend.visible);
57 onBackgroundVisibleChanged: console.log("legend.onBackgroundVisibleChanged: " + visible);
58 onColorChanged: console.log("legend.onColorChanged: " + color);
59 onBorderColorChanged: console.log("legend.onBorderColorChanged: " + color);
60 }
61
62 Connections {
63 id: axisXConnections
64 target: null
65 onColorChanged: console.log("axisX.onColorChanged: " + color);
66 onLabelsVisibleChanged: console.log("axisX.onLabelsVisibleChanged: " + visible);
67 onLabelsColorChanged: console.log("axisX.onLabelsColorChanged: " + color);
68 onVisibleChanged: console.log("axisX.onVisibleChanged: " + visible);
69 onGridVisibleChanged: console.log("axisX.onGridVisibleChanged: " + visible);
70 onShadesVisibleChanged: console.log("axisX.onShadesVisibleChanged: " + visible);
71 onShadesColorChanged: console.log("axisX.onShadesColorChanged: " + color);
72 onShadesBorderColorChanged: console.log("axisX.onShadesBorderColorChanged: " + color);
73 onMinChanged: console.log("axisX.onMinChanged: " + min);
74 onMaxChanged: console.log("axisX.onMaxChanged: " + max);
75 }
76
77 Connections {
78 id: axisYConnections
79 target: null
80 onColorChanged: console.log("axisY.onColorChanged: " + color);
81 onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible);
82 onLabelsColorChanged: console.log("axisY.onLabelsColorChanged: " + color);
83 onVisibleChanged: console.log("axisY.onVisibleChanged: " + visible);
84 onGridVisibleChanged: console.log("axisY.onGridVisibleChanged: " + visible);
85 onShadesVisibleChanged: console.log("axisY.onShadesVisibleChanged: " + visible);
86 onShadesColorChanged: console.log("axisY.onShadesColorChanged: " + color);
87 onShadesBorderColorChanged: console.log("axisY.onShadesBorderColorChanged: " + color);
88 onMinChanged: console.log("axisY.onMinChanged: " + min);
89 onMaxChanged: console.log("axisY.onMaxChanged: " + max);
90 }
91
92 31 Button {
93 32 text: "visible"
94 33 onClicked: series.visible = !series.visible;
@@ -28,15 +28,27 ChartView {
28 28 legend.alignment: Qt.AlignBottom
29 29 axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"]
30 30
31 property variant series: daSeries
31 property variant series: barSeries
32 32
33 33 GroupedBarSeries {
34 id: daSeries
34 id: barSeries
35 35 name: "bar"
36 onClicked: console.log("onClicked: " + barset + " " + index);
37 onHovered: console.log("onHovered: " + barset + " " + status);
38 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
36 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
37 onClicked: console.log("barset.onClicked: " + index);
38 onHovered: console.log("barset.onHovered: " + status);
39 onColorChanged: console.log("barset.onColorChanged: " + color);
40 onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color);
41 onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color);
42 onCountChanged: console.log("barset.onCountChanged: " + count);
43 }
39 44 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
40 45 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
46
47 onNameChanged: console.log("groupedBarSeries.onNameChanged: " + series.name);
48 onVisibleChanged: console.log("groupedBarSeries.onVisibleChanged: " + series.visible);
49 onClicked: console.log("groupedBarSeries.onClicked: " + barset + " " + index);
50 onHovered: console.log("groupedBarSeries.onHovered: " + barset + " " + status);
51 onLabelsVisibleChanged: console.log("groupedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
52 onCountChanged: console.log("groupedBarSeries.onCountChanged: " + count);
41 53 }
42 54 }
@@ -22,15 +22,14 import QtQuick 1.0
22 22 import QtCommercial.Chart 1.0
23 23
24 24 ChartView {
25 property variant series: lineSeries
26
25 27 title: "line series"
26 28 anchors.fill: parent
27 29
28 property variant series: daSeries
29
30 30 LineSeries {
31 id: daSeries
31 id: lineSeries
32 32 name: "line 1"
33 onClicked: console.log("onClicked: " + point.x + ", " + point.y);
34 33 XyPoint { x: 0; y: 0 }
35 34 XyPoint { x: 1.1; y: 2.1 }
36 35 XyPoint { x: 1.9; y: 3.3 }
@@ -38,6 +37,15 ChartView {
38 37 XyPoint { x: 2.9; y: 4.9 }
39 38 XyPoint { x: 3.4; y: 3.0 }
40 39 XyPoint { x: 4.1; y: 3.3 }
40
41 onNameChanged: console.log("lineSeries.onNameChanged: " + name);
42 onVisibleChanged: console.log("lineSeries.onVisibleChanged: " + visible);
43 onClicked: console.log("lineSeries.onClicked: " + point.x + ", " + point.y);
44 onPointReplaced: console.log("lineSeries.onPointReplaced: " + index);
45 onPointRemoved: console.log("lineSeries.onPointRemoved: " + index);
46 onPointAdded: console.log("lineSeries.onPointAdded: " + index);
47 onColorChanged: console.log("lineSeries.onColorChanged: " + color);
48 onCountChanged: console.log("lineSeries.onCountChanged: " + count);
41 49 }
42 50
43 51 LineSeries {
@@ -28,23 +28,6 Flow {
28 28 flow: Flow.TopToBottom
29 29 property variant series
30 30
31 onSeriesChanged: {
32 if (series && (series.name == "line 1" || series.name == "spline 1")) {
33 seriesConnections.target = series;
34 } else {
35 seriesConnections.target = null;
36 }
37 }
38
39 Connections {
40 id: seriesConnections
41 target: null
42 onNameChanged: console.log("series.onNameChanged: " + series.name);
43 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
44 onColorChanged: console.log("series.onColorChanged: " + series.color);
45 onCountChanged: console.log("series.onCountChanged: " + series.count);
46 }
47
48 31 Button {
49 32 text: "visible"
50 33 onClicked: series.visible = !series.visible;
@@ -28,15 +28,27 ChartView {
28 28 legend.alignment: Qt.AlignBottom
29 29 axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"]
30 30
31 property variant series: daSeries
31 property variant series: barSeries
32 32
33 33 PercentBarSeries {
34 id: daSeries
34 id: barSeries
35 35 name: "bar"
36 onClicked: console.log("onClicked: " + barset + " " + index);
37 onHovered: console.log("onHovered: " + barset + " " + status);
38 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
36 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
37 onClicked: console.log("barset.onClicked: " + index);
38 onHovered: console.log("barset.onHovered: " + status);
39 onColorChanged: console.log("barset.onColorChanged: " + color);
40 onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color);
41 onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color);
42 onCountChanged: console.log("barset.onCountChanged: " + count);
43 }
39 44 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
40 45 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
46
47 onNameChanged: console.log("percentBarSeries.onNameChanged: " + series.name);
48 onVisibleChanged: console.log("percentBarSeries.onVisibleChanged: " + series.visible);
49 onClicked: console.log("percentBarSeries.onClicked: " + barset + " " + index);
50 onHovered: console.log("percentBarSeries.onHovered: " + barset + " " + status);
51 onLabelsVisibleChanged: console.log("percentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
52 onCountChanged: console.log("percentBarSeries.onCountChanged: " + count);
41 53 }
42 54 }
@@ -31,8 +31,36 ChartView {
31 31 PieSeries {
32 32 id: pieSeries
33 33 name: "pie"
34 PieSlice { label: "slice1"; value: 11 }
34 PieSlice { label: "slice1"; value: 11;
35 onValueChanged: console.log("slice.onValueChanged: " + value);
36 onLabelVisibleChanged: console.log("slice.onLabelVisibleChanged: " + labelVisible);
37 onPenChanged: console.log("slice.onPenChanged: " + pen);
38 onBorderColorChanged: console.log("slice.onBorderColorChanged: " + borderColor);
39 onBorderWidthChanged: console.log("slice.onBorderWidthChanged: " + borderWidth);
40 onBrushChanged: console.log("slice.onBrushChanged: " + brush);
41 onColorChanged: console.log("slice.onColorChanged: " + color);
42 onLabelColorChanged: console.log("slice.onLabelColorChanged: " + labelColor);
43 onLabelBrushChanged: console.log("slice.onLabelBrushChanged: " + labelBrush);
44 onLabelFontChanged: console.log("slice.onLabelFontChanged: " + labelFont);
45 onPercentageChanged: console.log("slice.onPercentageChanged: " + percentage);
46 onStartAngleChanged: console.log("slice.onStartAngleChanged: " + startAngle);
47 onAngleSpanChanged: console.log("slice.onAngleSpanChanged: " + angleSpan);
48 onClicked: console.log("slice.onClicked: " + label);
49 onHovered: console.log("slice.onHovered: " + state);
50 }
35 51 PieSlice { label: "slice2"; value: 22 }
36 52 PieSlice { label: "slice3"; value: 33 }
53 PieSlice { label: "slice4"; value: 44 }
54
55 onNameChanged: console.log("pieSeries.onNameChanged: " + series.name);
56 onVisibleChanged: console.log("pieSeries.onVisibleChanged: " + series.visible);
57 onClicked: console.log("pieSeries.onClicked: " + slice.label);
58 onHovered: console.log("pieSeries.onHovered: " + slice.label);
59 onAdded: console.log("pieSeries.onAdded: " + slices);
60 onSliceAdded: console.log("pieSeries.onSliceAdded: " + slice.label);
61 onRemoved: console.log("pieSeries.onRemoved: " + slices);
62 onSliceRemoved: console.log("pieSeries.onSliceRemoved: " + slice.label);
63 onCountChanged: console.log("pieSeries.onCountChanged: " + series.count);
64 onSumChanged: console.log("pieSeries.onSumChanged: " + series.sum);
37 65 }
38 66 }
@@ -27,44 +27,6 Flow {
27 27 flow: Flow.TopToBottom
28 28 property variant series
29 29
30 onSeriesChanged: {
31 if (series && series.name == "pie") {
32 seriesConnections.target = series;
33 sliceConnections.target = series.at(0);
34 } else {
35 seriesConnections.target = null;
36 sliceConnections.target = null;
37 }
38 }
39
40 Connections {
41 id: seriesConnections
42 target: null
43 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
44 onCountChanged: console.log("series.onCountChanged: " + series.count);
45 onSumChanged: console.log("series.onSumChanged: " + series.sum);
46 }
47
48 Connections {
49 id: sliceConnections
50 target: null
51 onValueChanged: console.log("slice.onValueChanged: " + series.at(0).value);
52 onLabelVisibleChanged: console.log("slice.onLabelVisibleChanged: " + series.at(0).labelVisible);
53 onPenChanged: console.log("slice.onPenChanged: " + series.at(0).pen);
54 onBorderColorChanged: console.log("slice.onBorderColorChanged: " + series.at(0).borderColor);
55 onBorderWidthChanged: console.log("slice.onBorderWidthChanged: " + series.at(0).borderWidth);
56 onBrushChanged: console.log("slice.onBrushChanged: " + series.at(0).brush);
57 onColorChanged: console.log("slice.onColorChanged: " + series.at(0).color);
58 onLabelColorChanged: console.log("slice.onLabelColorChanged: " + series.at(0).labelColor);
59 onLabelBrushChanged: console.log("slice.onLabelBrushChanged: " + series.at(0).labelBrush);
60 onLabelFontChanged: console.log("slice.onLabelFontChanged: " + series.at(0).labelFont);
61 onPercentageChanged: console.log("slice.onPercentageChanged: " + series.at(0).percentage);
62 onStartAngleChanged: console.log("slice.onStartAngleChanged: " + series.at(0).startAngle);
63 onAngleSpanChanged: console.log("slice.onAngleSpanChanged: " + series.at(0).angleSpan);
64 onClicked: console.log("slice.onClicked");
65 onHovered: console.log("slice.onHovered: " + state);
66 }
67
68 30 Button {
69 31 text: "visible"
70 32 onClicked: series.visible = !series.visible;
@@ -110,6 +72,10 Flow {
110 72 onClicked: series.endAngle -= 1.1;
111 73 }
112 74 Button {
75 text: "remove slice"
76 onClicked: series.remove(series.count - 1);
77 }
78 Button {
113 79 text: "slice color"
114 80 onClicked: series.at(0).color = main.nextColor();
115 81 }
@@ -25,10 +25,10 ChartView {
25 25 title: "scatter series"
26 26 axisX.max: 4
27 27 axisY.max: 4
28 property variant series: daSeries
28 property variant series: scatterSeries
29 29
30 30 ScatterSeries {
31 id: daSeries
31 id: scatterSeries
32 32 name: "scatter 1"
33 33 XyPoint { x: 1.5; y: 1.5 }
34 34 XyPoint { x: 1.5; y: 1.6 }
@@ -37,6 +37,12 ChartView {
37 37 XyPoint { x: 1.9; y: 1.6 }
38 38 XyPoint { x: 2.1; y: 1.3 }
39 39 XyPoint { x: 2.5; y: 2.1 }
40
41 onNameChanged: console.log("scatterSeries.onNameChanged: " + name);
42 onVisibleChanged: console.log("scatterSeries.onVisibleChanged: " + visible);
43 onColorChanged: console.log("scatterSeries.onColorChanged: " + color);
44 onBorderColorChanged: console.log("scatterSeries.onBorderColorChanged: " + borderColor);
45 onCountChanged: console.log("scatterSeries.onCountChanged: " + count);
40 46 }
41 47
42 48 ScatterSeries {
@@ -28,24 +28,6 Flow {
28 28 flow: Flow.TopToBottom
29 29 property variant series
30 30
31 onSeriesChanged: {
32 if (series && series.name == "scatter 1") {
33 seriesConnections.target = series;
34 } else {
35 seriesConnections.target = null;
36 }
37 }
38
39 Connections {
40 id: seriesConnections
41 target: null
42 onNameChanged: console.log("series.onNameChanged: " + series.name);
43 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
44 onColorChanged: console.log("series.onColorChanged: " + series.color);
45 onBorderColorChanged: console.log("series.onBorderColorChanged: " + series.borderColor);
46 onCountChanged: console.log("series.onCountChanged: " + series.count);
47 }
48
49 31 Button {
50 32 text: "visible"
51 33 onClicked: series.visible = !series.visible;
@@ -24,10 +24,10 import QtCommercial.Chart 1.0
24 24 ChartView {
25 25 title: "spline series"
26 26 anchors.fill: parent
27 property variant series: daSeries
27 property variant series: splineSeries
28 28
29 29 SplineSeries {
30 id: daSeries
30 id: splineSeries
31 31 name: "spline 1"
32 32 XyPoint { x: 0; y: 0 }
33 33 XyPoint { x: 1.1; y: 2.1 }
@@ -36,6 +36,15 ChartView {
36 36 XyPoint { x: 2.9; y: 4.9 }
37 37 XyPoint { x: 3.4; y: 3.0 }
38 38 XyPoint { x: 4.1; y: 3.3 }
39
40 onNameChanged: console.log("splineSeries.onNameChanged: " + name);
41 onVisibleChanged: console.log("splineSeries.onVisibleChanged: " + visible);
42 onClicked: console.log("splineSeries.onClicked: " + point.x + ", " + point.y);
43 onPointReplaced: console.log("splineSeries.onPointReplaced: " + index);
44 onPointRemoved: console.log("splineSeries.onPointRemoved: " + index);
45 onPointAdded: console.log("splineSeries.onPointAdded: " + index);
46 onColorChanged: console.log("splineSeries.onColorChanged: " + color);
47 onCountChanged: console.log("splineSeries.onCountChanged: " + count);
39 48 }
40 49
41 50 SplineSeries {
@@ -28,15 +28,27 ChartView {
28 28 legend.alignment: Qt.AlignBottom
29 29 axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"]
30 30
31 property variant series: daSeries
31 property variant series: barSeries
32 32
33 33 StackedBarSeries {
34 id: daSeries
34 id: barSeries
35 35 name: "bar"
36 onClicked: console.log("onClicked: " + barset + " " + index);
37 onHovered: console.log("onHovered: " + barset + " " + status);
38 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
36 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
37 onClicked: console.log("barset.onClicked: " + index);
38 onHovered: console.log("barset.onHovered: " + status);
39 onColorChanged: console.log("barset.onColorChanged: " + color);
40 onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color);
41 onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color);
42 onCountChanged: console.log("barset.onCountChanged: " + count);
43 }
39 44 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
40 45 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
46
47 onNameChanged: console.log("stackedBarSeries.onNameChanged: " + series.name);
48 onVisibleChanged: console.log("stackedBarSeries.onVisibleChanged: " + series.visible);
49 onClicked: console.log("stackedBarSeries.onClicked: " + barset + " " + index);
50 onHovered: console.log("stackedBarSeries.onHovered: " + barset + " " + status);
51 onLabelsVisibleChanged: console.log("stackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
52 onCountChanged: console.log("stackedBarSeries.onCountChanged: " + count);
41 53 }
42 54 }
@@ -32,7 +32,6 Rectangle {
32 32
33 33 function nextColor() {
34 34 colorIndex++;
35 console.log("color: " + colors[colorIndex % colors.length]);
36 35 return colors[colorIndex % colors.length];
37 36 }
38 37
General Comments 0
You need to be logged in to leave comments. Login now