##// END OF EJS Templates
Removed bar categories from QML apps
Tero Ahola -
r1319:74c1c24d3ff3
parent child
Show More
@@ -29,11 +29,9 Rectangle {
29 anchors.fill: parent
29 anchors.fill: parent
30 theme: ChartView.ChartThemeLight
30 theme: ChartView.ChartThemeLight
31 legend: ChartView.LegendBottom
31 legend: ChartView.LegendBottom
32 // TODO: labels defined by x-axis, not by bar series
32 axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"]
33 axisXLabels: ["0", "2008", "1", "2009", "2", "2010", "3", "2012"]
34
33
35 GroupedBarSeries {
34 GroupedBarSeries {
36 barCategories: [ "2008", "2009", "2010", "2011", "2012" ]
37 BarSet { name: "Bob"; values: [2, 2, 3, 4, 5, 6] }
35 BarSet { name: "Bob"; values: [2, 2, 3, 4, 5, 6] }
38 BarSet { name: "Susan"; values: [5, 1, 2, 4, 1, 7] }
36 BarSet { name: "Susan"; values: [5, 1, 2, 4, 1, 7] }
39 BarSet { name: "James"; values: [3, 5, 8, 13, 5, 8] }
37 BarSet { name: "James"; values: [3, 5, 8, 13, 5, 8] }
@@ -96,7 +96,6 Rectangle {
96
96
97 GroupedBarSeries {
97 GroupedBarSeries {
98 name: "Skoda and Volvo"
98 name: "Skoda and Volvo"
99 barCategories: [ "1", "2", "3", "4", "5", "6" ]
100 HBarModelMapper {
99 HBarModelMapper {
101 model: customModel
100 model: customModel
102 firstBarSetRow: 4
101 firstBarSetRow: 4
@@ -35,11 +35,10 Rectangle {
35 anchors.left: parent.left
35 anchors.left: parent.left
36 anchors.right: parent.right
36 anchors.right: parent.right
37 legend: ChartView.LegendTop
37 legend: ChartView.LegendTop
38 axisXLabels: ["0", "Mo", "1", "Tu", "2", "We", "3", "Th", "4", "Fr", "5", "Sa"]
38
39
39 //![2]
40 //![2]
40 // BarSeries {
41 BarSeries {
41 GroupedBarSeries {
42 barCategories: [ "2008", "2009", "2010", "2011", "2012" ]
43 BarSet {
42 BarSet {
44 id: rainfallSet
43 id: rainfallSet
45 name: "Rainfall"
44 name: "Rainfall"
@@ -122,16 +122,6 void DeclarativeBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject
122 Q_UNUSED(element);
122 Q_UNUSED(element);
123 }
123 }
124
124
125 void DeclarativeBarSeries::setBarCategories(QStringList categories)
126 {
127 setCategories(categories);
128 }
129
130 QStringList DeclarativeBarSeries::barCategories()
131 {
132 return categories();
133 }
134
135 DeclarativeBarSet *DeclarativeBarSeries::at(int index)
125 DeclarativeBarSet *DeclarativeBarSeries::at(int index)
136 {
126 {
137 QList<QBarSet*> setList = barSets();
127 QList<QBarSet*> setList = barSets();
@@ -177,16 +167,6 void DeclarativeGroupedBarSeries::appendSeriesChildren(QDeclarativeListProperty<
177 Q_UNUSED(element);
167 Q_UNUSED(element);
178 }
168 }
179
169
180 void DeclarativeGroupedBarSeries::setBarCategories(QStringList categories)
181 {
182 setCategories(categories);
183 }
184
185 QStringList DeclarativeGroupedBarSeries::barCategories()
186 {
187 return categories();
188 }
189
190 DeclarativeBarSet *DeclarativeGroupedBarSeries::at(int index)
170 DeclarativeBarSet *DeclarativeGroupedBarSeries::at(int index)
191 {
171 {
192 QList<QBarSet*> setList = barSets();
172 QList<QBarSet*> setList = barSets();
@@ -61,17 +61,12 class DeclarativeBarSeries : public QBarSeries, public QDeclarativeParserStatus
61 {
61 {
62 Q_OBJECT
62 Q_OBJECT
63 Q_INTERFACES(QDeclarativeParserStatus)
63 Q_INTERFACES(QDeclarativeParserStatus)
64 Q_PROPERTY(QStringList barCategories READ barCategories WRITE setBarCategories)
65 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
64 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
66 Q_CLASSINFO("DefaultProperty", "seriesChildren")
65 Q_CLASSINFO("DefaultProperty", "seriesChildren")
67
66
68 public:
67 public:
69 explicit DeclarativeBarSeries(QDeclarativeItem *parent = 0);
68 explicit DeclarativeBarSeries(QDeclarativeItem *parent = 0);
70 QDeclarativeListProperty<QObject> seriesChildren();
69 QDeclarativeListProperty<QObject> seriesChildren();
71
72 void setBarCategories(QStringList categories);
73 QStringList barCategories();
74
75 Q_INVOKABLE DeclarativeBarSet *at(int index);
70 Q_INVOKABLE DeclarativeBarSet *at(int index);
76
71
77 public: // from QDeclarativeParserStatus
72 public: // from QDeclarativeParserStatus
@@ -86,17 +81,12 class DeclarativeGroupedBarSeries : public QGroupedBarSeries, public QDeclarativ
86 {
81 {
87 Q_OBJECT
82 Q_OBJECT
88 Q_INTERFACES(QDeclarativeParserStatus)
83 Q_INTERFACES(QDeclarativeParserStatus)
89 Q_PROPERTY(QStringList barCategories READ barCategories WRITE setBarCategories)
90 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
84 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
91 Q_CLASSINFO("DefaultProperty", "seriesChildren")
85 Q_CLASSINFO("DefaultProperty", "seriesChildren")
92
86
93 public:
87 public:
94 explicit DeclarativeGroupedBarSeries(QDeclarativeItem *parent = 0);
88 explicit DeclarativeGroupedBarSeries(QDeclarativeItem *parent = 0);
95 QDeclarativeListProperty<QObject> seriesChildren();
89 QDeclarativeListProperty<QObject> seriesChildren();
96
97 void setBarCategories(QStringList categories);
98 QStringList barCategories();
99
100 Q_INVOKABLE DeclarativeBarSet *at(int index);
90 Q_INVOKABLE DeclarativeBarSet *at(int index);
101
91
102 public: // from QDeclarativeParserStatus
92 public: // from QDeclarativeParserStatus
@@ -26,16 +26,14 ChartView {
26 anchors.fill: parent
26 anchors.fill: parent
27 theme: ChartView.ChartThemeLight
27 theme: ChartView.ChartThemeLight
28 legend: ChartView.LegendBottom
28 legend: ChartView.LegendBottom
29 // TODO: labels defined by x-axis, not by bar series
29 axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"]
30 axisXLabels: ["0", "2008", "1", "2009", "2", "2010", "3", "2012"]
31
30
32 property variant series: daSeries
31 property variant series: daSeries
33
32
34 BarSeries {
33 BarSeries {
35 id: daSeries
34 id: daSeries
36 barCategories: [ "2008", "2009", "2010", "2011", "2012" ]
35 BarSet { name: "Bob"; values: [4, 7, 3, 10, 5, 6] }
37 BarSet { name: "Bob"; values: [2, 2, 3, 4, 5, 6] }
36 BarSet { name: "Susan"; values: [5, 1, 2, 4, 1, 8] }
38 BarSet { name: "Susan"; values: [5, 1, 2, 4, 1, 7] }
37 BarSet { name: "James"; values: [3, 5, 8, 5, 4, 7] }
39 BarSet { name: "James"; values: [3, 5, 8, 13, 5, 8] }
40 }
38 }
41 }
39 }
@@ -26,14 +26,12 ChartView {
26 anchors.fill: parent
26 anchors.fill: parent
27 theme: ChartView.ChartThemeLight
27 theme: ChartView.ChartThemeLight
28 legend: ChartView.LegendBottom
28 legend: ChartView.LegendBottom
29 // TODO: labels defined by x-axis, not by bar series
29 axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"]
30 axisXLabels: ["0", "2008", "1", "2009", "2", "2010", "3", "2012"]
31
30
32 property variant series: daSeries
31 property variant series: daSeries
33
32
34 GroupedBarSeries {
33 GroupedBarSeries {
35 id: daSeries
34 id: daSeries
36 barCategories: [ "2008", "2009", "2010", "2011", "2012" ]
37 BarSet { name: "Bob"; values: [2, 2, 3, 4, 5, 6] }
35 BarSet { name: "Bob"; values: [2, 2, 3, 4, 5, 6] }
38 BarSet { name: "Susan"; values: [5, 1, 2, 4, 1, 7] }
36 BarSet { name: "Susan"; values: [5, 1, 2, 4, 1, 7] }
39 BarSet { name: "James"; values: [3, 5, 8, 13, 5, 8] }
37 BarSet { name: "James"; values: [3, 5, 8, 13, 5, 8] }
@@ -26,8 +26,7 ChartView {
26 anchors.fill: parent
26 anchors.fill: parent
27 theme: ChartView.ChartThemeLight
27 theme: ChartView.ChartThemeLight
28 legend: ChartView.LegendBottom
28 legend: ChartView.LegendBottom
29 // TODO: labels defined by x-axis, not by bar series
29 axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"]
30 axisXLabels: ["0", "2008", "1", "2009", "2", "2010", "3", "2012"]
31
30
32 property variant series: daSeries
31 property variant series: daSeries
33
32
@@ -26,7 +26,7 ChartView {
26 anchors.fill: parent
26 anchors.fill: parent
27 theme: ChartView.ChartThemeLight
27 theme: ChartView.ChartThemeLight
28 legend: ChartView.LegendBottom
28 legend: ChartView.LegendBottom
29 axisXLabels: ["0", "2008", "1", "2009", "2", "2010", "3", "2012"]
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: daSeries
32
32
General Comments 0
You need to be logged in to leave comments. Login now