@@ -0,0 +1,75 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | import QtQuick 1.0 | |
|
22 | import QtCommercial.Chart 1.1 | |
|
23 | ||
|
24 | ChartView { | |
|
25 | id: chartView | |
|
26 | title: "chart axes" | |
|
27 | ||
|
28 | // TODO: Do we need a property for orientation or properties "axisX" and "axisY" on ChartView | |
|
29 | // to make an axis the default axis for all series with no other axes defined...? | |
|
30 | // ValueAxis { | |
|
31 | // orientation: ValueAxis.AxisX | |
|
32 | // min: 0 | |
|
33 | // max: 10 | |
|
34 | // } | |
|
35 | // axisX: ValueAxis { | |
|
36 | // min: 0 | |
|
37 | // max: 10 | |
|
38 | // } | |
|
39 | // ...Now that we don't have this implementation, the following axes won't have any affect: | |
|
40 | ValueAxis { | |
|
41 | min: 0 | |
|
42 | max: 10 | |
|
43 | } | |
|
44 | ValueAxis { | |
|
45 | min: 0 | |
|
46 | max: 5 | |
|
47 | } | |
|
48 | ||
|
49 | LineSeries { | |
|
50 | name: "line series" | |
|
51 | XYPoint { x: 0; y: 0 } | |
|
52 | XYPoint { x: 1; y: 1 } | |
|
53 | XYPoint { x: 2; y: 2 } | |
|
54 | XYPoint { x: 3; y: 3 } | |
|
55 | XYPoint { x: 4; y: 4 } | |
|
56 | } | |
|
57 | ||
|
58 | ScatterSeries { | |
|
59 | name: "scatter series" | |
|
60 | XYPoint { x: 0; y: 0 } | |
|
61 | XYPoint { x: 0.5; y: 1 } | |
|
62 | XYPoint { x: 1; y: 2 } | |
|
63 | XYPoint { x: 1.5; y: 3 } | |
|
64 | XYPoint { x: 2; y: 4 } | |
|
65 | XYPoint { x: 1; y: 1 } | |
|
66 | XYPoint { x: 2; y: 2 } | |
|
67 | XYPoint { x: 3; y: 3 } | |
|
68 | XYPoint { x: 4; y: 4 } | |
|
69 | } | |
|
70 | ||
|
71 | // Component.onCompleted: { | |
|
72 | // // You can also set the axes dynamically | |
|
73 | // chartView.setAxisX(axisX, scatter); | |
|
74 | // } | |
|
75 | } |
@@ -0,0 +1,71 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | import QtQuick 1.0 | |
|
22 | import QtCommercial.Chart 1.1 | |
|
23 | ||
|
24 | ChartView { | |
|
25 | title: "default + user defined" | |
|
26 | ||
|
27 | ValueAxis { | |
|
28 | id: axisX | |
|
29 | min: 0 | |
|
30 | max: 6 | |
|
31 | } | |
|
32 | ||
|
33 | ValueAxis { | |
|
34 | id: axisY | |
|
35 | min: 0 | |
|
36 | max: 6 | |
|
37 | } | |
|
38 | ||
|
39 | LineSeries { | |
|
40 | name: "line series 1" | |
|
41 | XYPoint { x: 0; y: 0 } | |
|
42 | XYPoint { x: 1; y: 1 } | |
|
43 | XYPoint { x: 2; y: 2 } | |
|
44 | XYPoint { x: 3; y: 3 } | |
|
45 | XYPoint { x: 4; y: 4 } | |
|
46 | } | |
|
47 | ||
|
48 | ScatterSeries { | |
|
49 | name: "scatter series" | |
|
50 | axisX: axisX | |
|
51 | axisY: axisY | |
|
52 | XYPoint { x: 0; y: 0 } | |
|
53 | XYPoint { x: 0.5; y: 1 } | |
|
54 | XYPoint { x: 1; y: 2 } | |
|
55 | XYPoint { x: 1.5; y: 3 } | |
|
56 | XYPoint { x: 2; y: 4 } | |
|
57 | XYPoint { x: 1; y: 1 } | |
|
58 | XYPoint { x: 2; y: 2 } | |
|
59 | XYPoint { x: 3; y: 3 } | |
|
60 | XYPoint { x: 4; y: 4 } | |
|
61 | } | |
|
62 | ||
|
63 | LineSeries { | |
|
64 | name: "line series 2" | |
|
65 | XYPoint { x: 0; y: 0 } | |
|
66 | XYPoint { x: 0.5; y: 1 } | |
|
67 | XYPoint { x: 1; y: 2 } | |
|
68 | XYPoint { x: 1.5; y: 3 } | |
|
69 | XYPoint { x: 2; y: 4 } | |
|
70 | } | |
|
71 | } |
@@ -0,0 +1,64 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | import QtQuick 1.0 | |
|
22 | import QtCommercial.Chart 1.1 | |
|
23 | ||
|
24 | ChartView { | |
|
25 | title: "user defined reverted" | |
|
26 | ||
|
27 | ValueAxis { | |
|
28 | id: axisX | |
|
29 | min: 0 | |
|
30 | max: 6 | |
|
31 | } | |
|
32 | ||
|
33 | ValueAxis { | |
|
34 | id: axisY | |
|
35 | min: 0 | |
|
36 | max: 6 | |
|
37 | } | |
|
38 | ||
|
39 | ScatterSeries { | |
|
40 | name: "scatter series" | |
|
41 | axisX: axisX | |
|
42 | axisY: axisY | |
|
43 | XYPoint { x: 0; y: 0 } | |
|
44 | XYPoint { x: 0.5; y: 1 } | |
|
45 | XYPoint { x: 1; y: 2 } | |
|
46 | XYPoint { x: 1.5; y: 3 } | |
|
47 | XYPoint { x: 2; y: 4 } | |
|
48 | XYPoint { x: 1; y: 1 } | |
|
49 | XYPoint { x: 2; y: 2 } | |
|
50 | XYPoint { x: 3; y: 3 } | |
|
51 | XYPoint { x: 4; y: 4 } | |
|
52 | } | |
|
53 | ||
|
54 | LineSeries { | |
|
55 | name: "line series" | |
|
56 | axisX: axisX | |
|
57 | axisY: axisY | |
|
58 | XYPoint { x: 0; y: 0 } | |
|
59 | XYPoint { x: 1; y: 1 } | |
|
60 | XYPoint { x: 2; y: 2 } | |
|
61 | XYPoint { x: 3; y: 3 } | |
|
62 | XYPoint { x: 4; y: 4 } | |
|
63 | } | |
|
64 | } |
@@ -255,7 +255,7 void DeclarativeChart::componentComplete() | |||
|
255 | 255 | QAbstractSeries *series = qobject_cast<QAbstractSeries *>(child); |
|
256 | 256 | m_chart->addSeries(series); |
|
257 | 257 | |
|
258 | // Set optional user defined axes and connect axis related signals | |
|
258 | // Set optional user defined axes for the series and connect axis related signals | |
|
259 | 259 | if (qobject_cast<DeclarativeLineSeries *>(child)) { |
|
260 | 260 | DeclarativeLineSeries *s = qobject_cast<DeclarativeLineSeries *>(child); |
|
261 | 261 | connect(s, SIGNAL(axisXChanged(QAbstractAxis*)), this, SLOT(handleAxisXSet(QAbstractAxis*))); |
@@ -317,31 +317,32 void DeclarativeChart::componentComplete() | |||
|
317 | 317 | setAxisX(s->axisX(), s); |
|
318 | 318 | setAxisY(s->axisY(), s); |
|
319 | 319 | } |
|
320 | ||
|
321 | // Create the missing axes for the series that cannot be painted without axes | |
|
322 | createDefaultAxes(series); | |
|
323 | } else if(qobject_cast<QAbstractAxis *>(child)) { | |
|
324 | // Do nothing, axes are set for the chart in the context of series | |
|
325 | 320 | } |
|
326 | 321 | } |
|
327 | 322 | |
|
323 | // Create the missing axes for the series that cannot be painted without axes | |
|
324 | foreach (QAbstractSeries *chartSeries, m_chart->series()) | |
|
325 | createDefaultAxes(chartSeries); | |
|
326 | ||
|
328 | 327 | QDeclarativeItem::componentComplete(); |
|
329 | 328 | } |
|
330 | 329 | |
|
331 | 330 | void DeclarativeChart::handleAxisXSet(QAbstractAxis* axis) |
|
332 | 331 | { |
|
333 | 332 | // qDebug() << "DeclarativeChart::handleAxisXSet" << sender() << axis; |
|
334 |
if (axis && qobject_cast< |
|
|
335 |
m_chart->setAxisX(axis, qobject_cast< |
|
|
336 |
|
|
|
333 | if (axis && qobject_cast<QAbstractSeries *>(sender())) | |
|
334 | m_chart->setAxisX(axis, qobject_cast<QAbstractSeries *>(sender())); | |
|
335 | else | |
|
336 | qWarning() << "Trying to set axisX to null."; | |
|
337 | 337 | } |
|
338 | 338 | |
|
339 | 339 | void DeclarativeChart::handleAxisYSet(QAbstractAxis* axis) |
|
340 | 340 | { |
|
341 | 341 | // qDebug() << "DeclarativeChart::handleAxisYSet" << sender() << axis; |
|
342 |
if (axis && qobject_cast< |
|
|
343 |
m_chart->setAxisY(axis, qobject_cast< |
|
|
344 |
|
|
|
342 | if (axis && qobject_cast<QAbstractSeries *>(sender())) | |
|
343 | m_chart->setAxisY(axis, qobject_cast<QAbstractSeries *>(sender())); | |
|
344 | else | |
|
345 | qWarning() << "Trying to set axisY to null."; | |
|
345 | 346 | } |
|
346 | 347 | |
|
347 | 348 | void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) |
@@ -23,49 +23,36 import QtCommercial.Chart 1.1 | |||
|
23 | 23 | |
|
24 | 24 | ChartView { |
|
25 | 25 | id: chartView |
|
26 |
title: " |
|
|
26 | title: "chart axes reverted" | |
|
27 | 27 | |
|
28 | 28 | ValueAxis { |
|
29 | id: axisX | |
|
30 | 29 | min: 0 |
|
31 | 30 | max: 10 |
|
32 | // TODO: property to fix orientation to "X" to make this the X default axis for all series | |
|
33 | // that don't have user defined X axis | |
|
34 | 31 |
|
|
35 | ||
|
36 | 32 | ValueAxis { |
|
37 | id: axisY | |
|
38 | 33 | min: 0 |
|
39 | 34 | max: 5 |
|
40 | // TODO: property to fix orientation to "Y" to make this the Y default axis for all series | |
|
41 | // that don't have user defined Y axis | |
|
42 | } | |
|
43 | ||
|
44 | LineSeries { | |
|
45 | name: "line series" | |
|
46 | XYPoint { x: 0; y: 0 } | |
|
47 | XYPoint { x: 1.1; y: 2.1 } | |
|
48 | XYPoint { x: 1.9; y: 3.3 } | |
|
49 | XYPoint { x: 2.1; y: 2.1 } | |
|
50 | XYPoint { x: 2.9; y: 4.9 } | |
|
51 | XYPoint { x: 3.4; y: 3.0 } | |
|
52 | XYPoint { x: 4.1; y: 3.3 } | |
|
53 | 35 | } |
|
54 | 36 | |
|
55 | 37 | ScatterSeries { |
|
56 | 38 | name: "scatter series" |
|
57 | id: scatter | |
|
58 | 39 | XYPoint { x: 0; y: 0 } |
|
59 |
XYPoint { x: |
|
|
60 |
XYPoint { x: 1 |
|
|
61 |
XYPoint { x: |
|
|
62 |
XYPoint { x: 2 |
|
|
63 |
XYPoint { x: |
|
|
64 |
XYPoint { x: |
|
|
40 | XYPoint { x: 0.5; y: 1 } | |
|
41 | XYPoint { x: 1; y: 2 } | |
|
42 | XYPoint { x: 1.5; y: 3 } | |
|
43 | XYPoint { x: 2; y: 4 } | |
|
44 | XYPoint { x: 1; y: 1 } | |
|
45 | XYPoint { x: 2; y: 2 } | |
|
46 | XYPoint { x: 3; y: 3 } | |
|
47 | XYPoint { x: 4; y: 4 } | |
|
65 | 48 | } |
|
66 | 49 | |
|
67 | Component.onCompleted: { | |
|
68 | // You can also set the axes dynamically | |
|
69 | chartView.setAxisX(axisX, scatter); | |
|
50 | LineSeries { | |
|
51 | name: "line series" | |
|
52 | XYPoint { x: 0; y: 0 } | |
|
53 | XYPoint { x: 1; y: 1 } | |
|
54 | XYPoint { x: 2; y: 2 } | |
|
55 | XYPoint { x: 3; y: 3 } | |
|
56 | XYPoint { x: 4; y: 4 } | |
|
70 | 57 | } |
|
71 | 58 | } |
@@ -33,16 +33,16 ChartView { | |||
|
33 | 33 | onTriggered: { |
|
34 | 34 | switch (index) { |
|
35 | 35 | case 0: |
|
36 |
chartView.axisX(lineSeries).max = |
|
|
37 |
chartView.axisY(lineSeries).max = |
|
|
36 | chartView.axisX(lineSeries).max = 6; | |
|
37 | chartView.axisY(lineSeries).max = 6; | |
|
38 | 38 | break; |
|
39 | 39 | case 1: |
|
40 | 40 | chartView.axisX(scatterSeries).max = 10; |
|
41 | 41 | chartView.axisY(scatterSeries).max = 10; |
|
42 | 42 | break; |
|
43 | 43 | default: |
|
44 |
chartView.axisX().max = |
|
|
45 |
chartView.axisY().max = |
|
|
44 | chartView.axisX().max = 4; | |
|
45 | chartView.axisY().max = 4; | |
|
46 | 46 | } |
|
47 | 47 | index = (index + 1) % 3; |
|
48 | 48 | } |
@@ -52,23 +52,23 ChartView { | |||
|
52 | 52 | id: lineSeries |
|
53 | 53 | name: "line series" |
|
54 | 54 | XYPoint { x: 0; y: 0 } |
|
55 |
XYPoint { x: 1 |
|
|
56 |
XYPoint { x: |
|
|
57 |
XYPoint { x: |
|
|
58 |
XYPoint { x: |
|
|
59 | XYPoint { x: 3.4; y: 3.0 } | |
|
60 | XYPoint { x: 4.1; y: 3.3 } | |
|
55 | XYPoint { x: 1; y: 1 } | |
|
56 | XYPoint { x: 2; y: 2 } | |
|
57 | XYPoint { x: 3; y: 3 } | |
|
58 | XYPoint { x: 4; y: 4 } | |
|
61 | 59 | } |
|
62 | 60 | |
|
63 | 61 | ScatterSeries { |
|
64 | 62 | id: scatterSeries |
|
65 | 63 | name: "scatter series" |
|
66 | 64 | XYPoint { x: 0; y: 0 } |
|
67 |
XYPoint { x: |
|
|
68 |
XYPoint { x: 1 |
|
|
69 |
XYPoint { x: |
|
|
70 |
XYPoint { x: 2 |
|
|
71 |
XYPoint { x: |
|
|
72 |
XYPoint { x: |
|
|
65 | XYPoint { x: 0.5; y: 1 } | |
|
66 | XYPoint { x: 1; y: 2 } | |
|
67 | XYPoint { x: 1.5; y: 3 } | |
|
68 | XYPoint { x: 2; y: 4 } | |
|
69 | XYPoint { x: 1; y: 1 } | |
|
70 | XYPoint { x: 2; y: 2 } | |
|
71 | XYPoint { x: 3; y: 3 } | |
|
72 | XYPoint { x: 4; y: 4 } | |
|
73 | 73 | } |
|
74 | 74 | } |
@@ -23,7 +23,7 import QtCommercial.Chart 1.1 | |||
|
23 | 23 | |
|
24 | 24 | ChartView { |
|
25 | 25 | id: chartView |
|
26 |
title: " |
|
|
26 | title: "creating dyn. new series" | |
|
27 | 27 | property int index: 0 |
|
28 | 28 | |
|
29 | 29 | Timer { |
@@ -33,16 +33,16 ChartView { | |||
|
33 | 33 | onTriggered: { |
|
34 | 34 | switch (index) { |
|
35 | 35 | case 0: |
|
36 | while (chartView.count) | |
|
36 | while (chartView.count) { | |
|
37 | console.log("Destroying series. Count: " + chartView.count); | |
|
37 | 38 | chartView.series(0).destroy(); |
|
39 | } | |
|
38 | 40 | var line = chartView.createSeries(ChartView.SeriesTypeLine, "line"); |
|
39 | 41 | line.append(0, 0); |
|
40 |
line.append(1 |
|
|
41 |
line.append( |
|
|
42 |
line.append( |
|
|
43 |
line.append( |
|
|
44 | line.append(3.4, 3.0); | |
|
45 | line.append(4.1, 3.3); | |
|
42 | line.append(1, 1); | |
|
43 | line.append(2, 2); | |
|
44 | line.append(3, 3); | |
|
45 | line.append(4, 4); | |
|
46 | 46 | break; |
|
47 | 47 | case 1: |
|
48 | 48 | chartView.axisX().min = 0; |
@@ -53,12 +53,14 ChartView { | |||
|
53 | 53 | default: |
|
54 | 54 | var scatter = chartView.createSeries(ChartView.SeriesTypeScatter, "scatter"); |
|
55 | 55 | scatter.append(0, 0); |
|
56 |
scatter.append( |
|
|
57 |
scatter.append(1 |
|
|
58 |
scatter.append( |
|
|
59 |
scatter.append(2 |
|
|
60 |
scatter.append( |
|
|
61 |
scatter.append( |
|
|
56 | scatter.append(0.5, 1); | |
|
57 | scatter.append(1, 2); | |
|
58 | scatter.append(1.5, 3); | |
|
59 | scatter.append(2, 4); | |
|
60 | scatter.append(1, 1); | |
|
61 | scatter.append(2, 2); | |
|
62 | scatter.append(3, 3); | |
|
63 | scatter.append(4, 4); | |
|
62 | 64 | } |
|
63 | 65 | index = (index + 1) % 3; |
|
64 | 66 | } |
@@ -28,22 +28,22 ChartView { | |||
|
28 | 28 | LineSeries { |
|
29 | 29 | name: "line series" |
|
30 | 30 | XYPoint { x: 0; y: 0 } |
|
31 |
XYPoint { x: 1 |
|
|
32 |
XYPoint { x: |
|
|
33 |
XYPoint { x: |
|
|
34 |
XYPoint { x: |
|
|
35 | XYPoint { x: 3.4; y: 3.0 } | |
|
36 | XYPoint { x: 4.1; y: 3.3 } | |
|
31 | XYPoint { x: 1; y: 1 } | |
|
32 | XYPoint { x: 2; y: 2 } | |
|
33 | XYPoint { x: 3; y: 3 } | |
|
34 | XYPoint { x: 4; y: 4 } | |
|
37 | 35 | } |
|
38 | 36 | |
|
39 | 37 | ScatterSeries { |
|
40 | 38 | name: "scatter series" |
|
41 | 39 | XYPoint { x: 0; y: 0 } |
|
42 |
XYPoint { x: |
|
|
43 |
XYPoint { x: 1 |
|
|
44 |
XYPoint { x: |
|
|
45 |
XYPoint { x: 2 |
|
|
46 |
XYPoint { x: |
|
|
47 |
XYPoint { x: |
|
|
40 | XYPoint { x: 0.5; y: 1 } | |
|
41 | XYPoint { x: 1; y: 2 } | |
|
42 | XYPoint { x: 1.5; y: 3 } | |
|
43 | XYPoint { x: 2; y: 4 } | |
|
44 | XYPoint { x: 1; y: 1 } | |
|
45 | XYPoint { x: 2; y: 2 } | |
|
46 | XYPoint { x: 3; y: 3 } | |
|
47 | XYPoint { x: 4; y: 4 } | |
|
48 | 48 | } |
|
49 | 49 | } |
@@ -23,21 +23,27 import QtCommercial.Chart 1.1 | |||
|
23 | 23 | |
|
24 | 24 | ChartView { |
|
25 | 25 | id: chartView |
|
26 | title: "axis scale; different series" | |
|
26 | title: "default axes" | |
|
27 | 27 | |
|
28 |
|
|
|
29 |
name: " |
|
|
28 | ScatterSeries { | |
|
29 | name: "scatter series" | |
|
30 | 30 | XYPoint { x: 0; y: 0 } |
|
31 |
XYPoint { x: |
|
|
32 |
XYPoint { x: 1 |
|
|
33 |
XYPoint { x: |
|
|
31 | XYPoint { x: 0.5; y: 1 } | |
|
32 | XYPoint { x: 1; y: 2 } | |
|
33 | XYPoint { x: 1.5; y: 3 } | |
|
34 | XYPoint { x: 2; y: 4 } | |
|
35 | XYPoint { x: 1; y: 1 } | |
|
36 | XYPoint { x: 2; y: 2 } | |
|
37 | XYPoint { x: 3; y: 3 } | |
|
38 | XYPoint { x: 4; y: 4 } | |
|
34 | 39 | } |
|
35 | 40 | |
|
36 |
|
|
|
37 |
name: " |
|
|
38 |
XYPoint { x: |
|
|
39 |
XYPoint { x: |
|
|
40 |
XYPoint { x: |
|
|
41 |
XYPoint { x: |
|
|
41 | LineSeries { | |
|
42 | name: "line series" | |
|
43 | XYPoint { x: 0; y: 0 } | |
|
44 | XYPoint { x: 1; y: 1 } | |
|
45 | XYPoint { x: 2; y: 2 } | |
|
46 | XYPoint { x: 3; y: 3 } | |
|
47 | XYPoint { x: 4; y: 4 } | |
|
42 | 48 | } |
|
43 | 49 | } |
@@ -35,22 +35,22 ChartView { | |||
|
35 | 35 | LineSeries { |
|
36 | 36 | name: "line series" |
|
37 | 37 | XYPoint { x: 0; y: 0 } |
|
38 |
XYPoint { x: 1 |
|
|
39 |
XYPoint { x: |
|
|
40 |
XYPoint { x: |
|
|
41 |
XYPoint { x: |
|
|
42 | XYPoint { x: 3.4; y: 3.0 } | |
|
43 | XYPoint { x: 4.1; y: 3.3 } | |
|
38 | XYPoint { x: 1; y: 1 } | |
|
39 | XYPoint { x: 2; y: 2 } | |
|
40 | XYPoint { x: 3; y: 3 } | |
|
41 | XYPoint { x: 4; y: 4 } | |
|
44 | 42 | } |
|
45 | 43 | |
|
46 | 44 | ScatterSeries { |
|
47 | 45 | name: "scatter series" |
|
48 | 46 | XYPoint { x: 0; y: 0 } |
|
49 |
XYPoint { x: |
|
|
50 |
XYPoint { x: 1 |
|
|
51 |
XYPoint { x: |
|
|
52 |
XYPoint { x: 2 |
|
|
53 |
XYPoint { x: |
|
|
54 |
XYPoint { x: |
|
|
47 | XYPoint { x: 0.5; y: 1 } | |
|
48 | XYPoint { x: 1; y: 2 } | |
|
49 | XYPoint { x: 1.5; y: 3 } | |
|
50 | XYPoint { x: 2; y: 4 } | |
|
51 | XYPoint { x: 1; y: 1 } | |
|
52 | XYPoint { x: 2; y: 2 } | |
|
53 | XYPoint { x: 3; y: 3 } | |
|
54 | XYPoint { x: 4; y: 4 } | |
|
55 | 55 | } |
|
56 | 56 | } |
@@ -33,20 +33,20 ChartView { | |||
|
33 | 33 | onTriggered: { |
|
34 | 34 | switch (index) { |
|
35 | 35 | case 0: |
|
36 |
lineAxisX.max = |
|
|
37 |
lineAxisY.max = |
|
|
36 | lineAxisX.max = 6; | |
|
37 | lineAxisY.max = 6; | |
|
38 | 38 | scatterAxisX.max = 10; |
|
39 | 39 | scatterAxisY.max = 10; |
|
40 | 40 | break; |
|
41 | 41 | case 1: |
|
42 | 42 | lineAxisX.max = 10; |
|
43 | 43 | lineAxisY.max = 10; |
|
44 |
scatterAxisX.max = |
|
|
45 |
scatterAxisY.max = |
|
|
44 | scatterAxisX.max = 6; | |
|
45 | scatterAxisY.max = 6; | |
|
46 | 46 | break; |
|
47 | 47 | default: |
|
48 |
chartView.axisX().max = |
|
|
49 |
chartView.axisY().max = |
|
|
48 | chartView.axisX().max = 4; | |
|
49 | chartView.axisY().max = 4; | |
|
50 | 50 | } |
|
51 | 51 | index = (index + 1) % 3; |
|
52 | 52 | } |
@@ -57,14 +57,11 ChartView { | |||
|
57 | 57 | name: "line series" |
|
58 | 58 | axisX: ValueAxis { id: lineAxisX } |
|
59 | 59 | axisY: ValueAxis { id: lineAxisY } |
|
60 | ||
|
61 | 60 | XYPoint { x: 0; y: 0 } |
|
62 |
XYPoint { x: 1 |
|
|
63 |
XYPoint { x: |
|
|
64 |
XYPoint { x: |
|
|
65 |
XYPoint { x: |
|
|
66 | XYPoint { x: 3.4; y: 3.0 } | |
|
67 | XYPoint { x: 4.1; y: 3.3 } | |
|
61 | XYPoint { x: 1; y: 1 } | |
|
62 | XYPoint { x: 2; y: 2 } | |
|
63 | XYPoint { x: 3; y: 3 } | |
|
64 | XYPoint { x: 4; y: 4 } | |
|
68 | 65 | } |
|
69 | 66 | |
|
70 | 67 | ScatterSeries { |
@@ -72,13 +69,14 ChartView { | |||
|
72 | 69 | name: "scatter series" |
|
73 | 70 | axisX: ValueAxis { id: scatterAxisX } |
|
74 | 71 | axisY: ValueAxis { id: scatterAxisY } |
|
75 | ||
|
76 | 72 | XYPoint { x: 0; y: 0 } |
|
77 |
XYPoint { x: |
|
|
78 |
XYPoint { x: 1 |
|
|
79 |
XYPoint { x: |
|
|
80 |
XYPoint { x: 2 |
|
|
81 |
XYPoint { x: |
|
|
82 |
XYPoint { x: |
|
|
73 | XYPoint { x: 0.5; y: 1 } | |
|
74 | XYPoint { x: 1; y: 2 } | |
|
75 | XYPoint { x: 1.5; y: 3 } | |
|
76 | XYPoint { x: 2; y: 4 } | |
|
77 | XYPoint { x: 1; y: 1 } | |
|
78 | XYPoint { x: 2; y: 2 } | |
|
79 | XYPoint { x: 3; y: 3 } | |
|
80 | XYPoint { x: 4; y: 4 } | |
|
83 | 81 | } |
|
84 | 82 | } |
@@ -30,10 +30,13 ChartView { | |||
|
30 | 30 | repeat: true |
|
31 | 31 | running: true |
|
32 | 32 | onTriggered: { |
|
33 | //console.log("current axisX: " + lineSeries.axisX + " 1: " + valueAxis1 + " 2: " +valueAxis2); | |
|
34 | ||
|
35 | // Note: an axis is destroyed if it is not used anymore | |
|
33 | 36 | if (lineSeries.axisX == valueAxis1) |
|
34 | 37 | lineSeries.axisX = valueAxis2; |
|
35 | else | |
|
36 |
lineSeries.axisX = valueAxis |
|
|
38 | else if (lineSeries.axisX == valueAxis2) | |
|
39 | lineSeries.axisX = valueAxis3; | |
|
37 | 40 | } |
|
38 | 41 | } |
|
39 | 42 | |
@@ -49,16 +52,20 ChartView { | |||
|
49 | 52 | max: 6 |
|
50 | 53 | } |
|
51 | 54 | |
|
55 | ValueAxis { | |
|
56 | id: valueAxis3 | |
|
57 | min: 2 | |
|
58 | max: 7 | |
|
59 | } | |
|
60 | ||
|
52 | 61 | LineSeries { |
|
53 | 62 | id: lineSeries |
|
54 | 63 | name: "line series" |
|
55 | 64 | axisX: valueAxis1 |
|
56 | 65 | XYPoint { x: 0; y: 0 } |
|
57 |
XYPoint { x: 1 |
|
|
58 |
XYPoint { x: |
|
|
59 |
XYPoint { x: |
|
|
60 |
XYPoint { x: |
|
|
61 | XYPoint { x: 3.4; y: 3.0 } | |
|
62 | XYPoint { x: 4.1; y: 3.3 } | |
|
66 | XYPoint { x: 1; y: 1 } | |
|
67 | XYPoint { x: 2; y: 2 } | |
|
68 | XYPoint { x: 3; y: 3 } | |
|
69 | XYPoint { x: 4; y: 4 } | |
|
63 | 70 | } |
|
64 | 71 | } |
@@ -22,12 +22,12 import QtQuick 1.0 | |||
|
22 | 22 | import QtCommercial.Chart 1.1 |
|
23 | 23 | |
|
24 | 24 | ChartView { |
|
25 |
title: "user defined |
|
|
25 | title: "user defined" | |
|
26 | 26 | |
|
27 | 27 | ValueAxis { |
|
28 | 28 | id: axisX |
|
29 | 29 | min: 0 |
|
30 |
max: |
|
|
30 | max: 6 | |
|
31 | 31 | } |
|
32 | 32 | |
|
33 | 33 | ValueAxis { |
@@ -41,12 +41,10 ChartView { | |||
|
41 | 41 | axisX: axisX |
|
42 | 42 | axisY: axisY |
|
43 | 43 | XYPoint { x: 0; y: 0 } |
|
44 |
XYPoint { x: 1 |
|
|
45 |
XYPoint { x: |
|
|
46 |
XYPoint { x: |
|
|
47 |
XYPoint { x: |
|
|
48 | XYPoint { x: 3.4; y: 3.0 } | |
|
49 | XYPoint { x: 4.1; y: 3.3 } | |
|
44 | XYPoint { x: 1; y: 1 } | |
|
45 | XYPoint { x: 2; y: 2 } | |
|
46 | XYPoint { x: 3; y: 3 } | |
|
47 | XYPoint { x: 4; y: 4 } | |
|
50 | 48 | } |
|
51 | 49 | |
|
52 | 50 | ScatterSeries { |
@@ -54,11 +52,13 ChartView { | |||
|
54 | 52 | axisX: axisX |
|
55 | 53 | axisY: axisY |
|
56 | 54 | XYPoint { x: 0; y: 0 } |
|
57 |
XYPoint { x: |
|
|
58 |
XYPoint { x: 1 |
|
|
59 |
XYPoint { x: |
|
|
60 |
XYPoint { x: 2 |
|
|
61 |
XYPoint { x: |
|
|
62 |
XYPoint { x: |
|
|
55 | XYPoint { x: 0.5; y: 1 } | |
|
56 | XYPoint { x: 1; y: 2 } | |
|
57 | XYPoint { x: 1.5; y: 3 } | |
|
58 | XYPoint { x: 2; y: 4 } | |
|
59 | XYPoint { x: 1; y: 1 } | |
|
60 | XYPoint { x: 2; y: 2 } | |
|
61 | XYPoint { x: 3; y: 3 } | |
|
62 | XYPoint { x: 4; y: 4 } | |
|
63 | 63 | } |
|
64 | 64 | } |
@@ -24,7 +24,7 Rectangle { | |||
|
24 | 24 | id: main |
|
25 | 25 | width: 400 |
|
26 | 26 | height: 300 |
|
27 |
property |
|
|
27 | property string viewName: "DefaultAxes" | |
|
28 | 28 | |
|
29 | 29 | Row { |
|
30 | 30 | anchors.fill: parent |
@@ -34,7 +34,7 Rectangle { | |||
|
34 | 34 | id: chartLoader |
|
35 | 35 | width: parent.width - buttonColumn.width |
|
36 | 36 | height: parent.height |
|
37 |
source: |
|
|
37 | source: viewName + ".qml" | |
|
38 | 38 | } |
|
39 | 39 | |
|
40 | 40 | Column { |
@@ -44,40 +44,52 Rectangle { | |||
|
44 | 44 | spacing: 5 |
|
45 | 45 | |
|
46 | 46 | Button { |
|
47 | text: "Default" | |
|
48 |
onClicked: viewN |
|
|
47 | text: "Default axes" | |
|
48 | onClicked: viewName = "DefaultAxes"; | |
|
49 | } | |
|
50 | Button { | |
|
51 | text: "Default axes reverted" | |
|
52 | onClicked: viewName = "DefaultAxesRevert"; | |
|
49 | 53 | } |
|
50 | 54 | Button { |
|
51 | 55 | text: "User defined" |
|
52 |
onClicked: viewN |
|
|
56 | onClicked: viewName = "UserDefined"; | |
|
57 | } | |
|
58 | Button { | |
|
59 | text: "User defined reverted" | |
|
60 | onClicked: viewName = "UserDefinedRevert"; | |
|
53 | 61 | } |
|
54 | 62 | Button { |
|
55 | 63 | text: "Chart axes" |
|
56 |
onClicked: viewN |
|
|
64 | onClicked: viewName = "ChartAxes"; | |
|
65 | } | |
|
66 | Button { | |
|
67 | text: "Chart axes reverted" | |
|
68 | onClicked: viewName = "ChartAxesRevert"; | |
|
57 | 69 | } |
|
58 | 70 | Button { |
|
59 | 71 | text: "Configuring dynamically" |
|
60 |
onClicked: viewN |
|
|
72 | onClicked: viewName = "ConfiguringDynamically"; | |
|
61 | 73 | } |
|
62 | 74 | Button { |
|
63 | 75 | text: "Series specific dynamic" |
|
64 |
onClicked: viewN |
|
|
76 | onClicked: viewName = "SeriesSpecificDynamic"; | |
|
65 | 77 | } |
|
66 | 78 | Button { |
|
67 | 79 | text: "Creating dynamically" |
|
68 |
onClicked: viewN |
|
|
80 | onClicked: viewName = "CreatingDynamically"; | |
|
69 | 81 | } |
|
70 | 82 | Button { |
|
71 | 83 | text: "Switching dynamically" |
|
72 |
onClicked: viewN |
|
|
84 | onClicked: viewName = "SwitchingDynamically"; | |
|
73 | 85 | } |
|
74 | 86 | Button { |
|
75 |
text: " |
|
|
76 |
onClicked: viewN |
|
|
87 | text: "Default + User defined" | |
|
88 | onClicked: viewName = "DefaultAndUserDefined"; | |
|
77 | 89 | } |
|
78 | 90 | Button { |
|
79 | 91 | text: "Legacy" |
|
80 |
onClicked: viewN |
|
|
92 | onClicked: viewName = "Legacy"; | |
|
81 | 93 | } |
|
82 | 94 | } |
|
83 | 95 | } |
@@ -2,14 +2,17 | |||
|
2 | 2 | <qresource prefix="/"> |
|
3 | 3 | <file>qml/qmlchartaxis/main.qml</file> |
|
4 | 4 | <file>qml/qmlchartaxis/Button.qml</file> |
|
5 |
<file>qml/qmlchartaxis/ |
|
|
6 |
<file>qml/qmlchartaxis/ |
|
|
7 |
<file>qml/qmlchartaxis/ |
|
|
8 |
<file>qml/qmlchartaxis/ |
|
|
9 |
<file>qml/qmlchartaxis/Chart |
|
|
10 |
<file>qml/qmlchartaxis/Chart |
|
|
11 |
<file>qml/qmlchartaxis/C |
|
|
12 |
<file>qml/qmlchartaxis/ |
|
|
13 |
<file>qml/qmlchartaxis/C |
|
|
5 | <file>qml/qmlchartaxis/DefaultAxes.qml</file> | |
|
6 | <file>qml/qmlchartaxis/DefaultAxesRevert.qml</file> | |
|
7 | <file>qml/qmlchartaxis/UserDefined.qml</file> | |
|
8 | <file>qml/qmlchartaxis/UserDefinedRevert.qml</file> | |
|
9 | <file>qml/qmlchartaxis/ChartAxes.qml</file> | |
|
10 | <file>qml/qmlchartaxis/ChartAxesRevert.qml</file> | |
|
11 | <file>qml/qmlchartaxis/ConfiguringDynamically.qml</file> | |
|
12 | <file>qml/qmlchartaxis/SeriesSpecificDynamic.qml</file> | |
|
13 | <file>qml/qmlchartaxis/CreatingDynamically.qml</file> | |
|
14 | <file>qml/qmlchartaxis/SwitchingDynamically.qml</file> | |
|
15 | <file>qml/qmlchartaxis/DefaultAndUserDefined.qml</file> | |
|
16 | <file>qml/qmlchartaxis/Legacy.qml</file> | |
|
14 | 17 | </qresource> |
|
15 | 18 | </RCC> |
General Comments 0
You need to be logged in to leave comments.
Login now