##// END OF EJS Templates
added horizontal barcharts to qmlchart demo
sauimone -
r1811:2e078ac5693a
parent child
Show More
@@ -0,0 +1,48
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.0
23
24 Rectangle {
25 anchors.fill: parent
26
27 //![1]
28 ChartView {
29 title: "Horizontal Stacked Bar series"
30 anchors.fill: parent
31 legend.alignment: Qt.AlignBottom
32 BarCategoriesAxis {
33 id: myAxis;
34 categories: ["2007", "2008", "2009", "2010", "2011", "2012" ]
35 }
36 HorizontalStackedBarSeries {
37 id: mySeries;
38 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
39 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
40 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
41 }
42 Component.onCompleted: {
43 createDefaultAxes();
44 setAxisY(myAxis,mySeries);
45 }
46 }
47 //![1]
48 }
@@ -0,0 +1,49
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.0
23
24 Rectangle {
25 anchors.fill: parent
26
27 //![1]
28 ChartView {
29 title: "Horizontal Percent Bar series"
30 anchors.fill: parent
31 legend.alignment: Qt.AlignBottom
32 BarCategoriesAxis {
33 id: myAxis
34 categories: ["2007", "2008", "2009", "2010", "2011", "2012" ]
35 }
36 HorizontalPercentBarSeries {
37 id: mySeries
38 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
39 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
40 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
41 }
42 Component.onCompleted: {
43 createDefaultAxes();
44 setAxisY(myAxis,mySeries);
45 }
46 }
47 //![1]
48 }
49
@@ -0,0 +1,49
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.0
23
24 Rectangle {
25 anchors.fill: parent
26
27 //![1]
28 ChartView {
29 title: "Horizontal Bar series"
30 anchors.fill: parent
31 legend.alignment: Qt.AlignBottom
32 BarCategoriesAxis {
33 id: myAxis
34 categories: ["2007", "2008", "2009", "2010", "2011", "2012" ]
35 }
36 HorizontalBarSeries {
37 id: mySeries
38 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
39 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
40 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
41 }
42 Component.onCompleted: {
43 createDefaultAxes();
44 setAxisY(myAxis,mySeries);
45 }
46 }
47 //![1]
48 }
49
@@ -74,7 +74,7 Rectangle {
74
74
75 function nextView() {
75 function nextView() {
76 var i = viewNumber + 1;
76 var i = viewNumber + 1;
77 if (i > 8)
77 if (i > 11)
78 viewNumber = 1;
78 viewNumber = 1;
79 else
79 else
80 viewNumber = i;
80 viewNumber = i;
@@ -83,7 +83,7 Rectangle {
83 function previousView() {
83 function previousView() {
84 var i = viewNumber - 1;
84 var i = viewNumber - 1;
85 if (i <= 0)
85 if (i <= 0)
86 viewNumber = 8;
86 viewNumber = 11;
87 else
87 else
88 viewNumber = i;
88 viewNumber = i;
89 }
89 }
@@ -10,5 +10,8
10 <file>qml/qmlchart/View6.qml</file>
10 <file>qml/qmlchart/View6.qml</file>
11 <file>qml/qmlchart/View7.qml</file>
11 <file>qml/qmlchart/View7.qml</file>
12 <file>qml/qmlchart/View8.qml</file>
12 <file>qml/qmlchart/View8.qml</file>
13 <file>qml/qmlchart/View9.qml</file>
14 <file>qml/qmlchart/View10.qml</file>
15 <file>qml/qmlchart/View11.qml</file>
13 </qresource>
16 </qresource>
14 </RCC>
17 </RCC>
@@ -478,6 +478,15 QAbstractSeries *DeclarativeChart::createSeries(DeclarativeChart::SeriesType typ
478 case DeclarativeChart::SeriesTypeBar:
478 case DeclarativeChart::SeriesTypeBar:
479 series = new DeclarativeBarSeries();
479 series = new DeclarativeBarSeries();
480 break;
480 break;
481 case DeclarativeChart::SeriesTypeHorizontalBar:
482 series = new DeclarativeHorizontalBarSeries();
483 break;
484 case DeclarativeChart::SeriesTypeHorizontalPercentBar:
485 series = new DeclarativeHorizontalPercentBarSeries();
486 break;
487 case DeclarativeChart::SeriesTypeHorizontalStackedBar:
488 series = new DeclarativeHorizontalStackedBarSeries();
489 break;
481 case DeclarativeChart::SeriesTypePie:
490 case DeclarativeChart::SeriesTypePie:
482 series = new DeclarativePieSeries();
491 series = new DeclarativePieSeries();
483 break;
492 break;
@@ -77,7 +77,10 public:
77 SeriesTypePercentBar,
77 SeriesTypePercentBar,
78 SeriesTypePie,
78 SeriesTypePie,
79 SeriesTypeScatter,
79 SeriesTypeScatter,
80 SeriesTypeSpline
80 SeriesTypeSpline,
81 SeriesTypeHorizontalBar,
82 SeriesTypeHorizontalStackedBar,
83 SeriesTypeHorizontalPercentBar
81 };
84 };
82
85
83 public:
86 public:
@@ -59,6 +59,9 public:
59 qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries");
59 qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries");
60 qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries");
60 qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries");
61 qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries");
61 qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries");
62 qmlRegisterType<DeclarativeHorizontalBarSeries>(uri, 1, 0, "HorizontalBarSeries");
63 qmlRegisterType<DeclarativeHorizontalStackedBarSeries>(uri, 1, 0, "HorizontalStackedBarSeries");
64 qmlRegisterType<DeclarativeHorizontalPercentBarSeries>(uri, 1, 0, "HorizontalPercentBarSeries");
62 qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries");
65 qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries");
63 qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice");
66 qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice");
64 qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet");
67 qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet");
General Comments 0
You need to be logged in to leave comments. Login now