forked from toby20130333/qchart.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
QChartGallery.qml
178 lines (146 loc) · 4.24 KB
/
QChartGallery.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/* QChartGallery.qml ---
*
* Author: Julien Wintz
* Created: Thu Feb 13 23:41:59 2014 (+0100)
* Version:
* Last-Updated: Fri Feb 14 12:58:42 2014 (+0100)
* By: Julien Wintz
* Update #: 5
*/
/* Change Log:
*
*/
import QtQuick 2.0
import "."
import "QChart.js" as Charts
import "QChartGallery.js" as ChartsData
Rectangle {
property int chart_width: 300;
property int chart_height: 300;
property int chart_spacing: 20;
property int text_height: 80;
property int row_height: 8;
color: "#ffffff";
width: chart_width*3 + 2*chart_spacing;
height: chart_height*2 + chart_spacing + 2*row_height + text_height;
// /////////////////////////////////////////////////////////////////
// Header
// /////////////////////////////////////////////////////////////////
Rectangle { color: "#282b36"; width: parent.width/1.0; height: row_height; }
Rectangle { color: "#f33e6f"; width: parent.width/3.0; height: row_height; x: 0*width; y: height; }
Rectangle { color: "#46bfbd"; width: parent.width/3.0; height: row_height; x: 1*width; y: height; }
Rectangle { color: "#fbd45c"; width: parent.width/3.0; height: row_height; x: 2*width; y: height; }
Text {
y: 2*row_height;
width: parent.width;
height: text_height;
text: "QChart.js";
font.pointSize: 32;
horizontalAlignment: Text.AlignHCenter;
verticalAlignment: Text.AlignVCenter;
Rectangle {
id: button;
anchors.top: parent.top;
anchors.topMargin: (parent.height-parent.font.pointSize)/2;
anchors.right: parent.right;
anchors.rightMargin: (parent.height-parent.font.pointSize)/2;
width: 100;
height: 32;
color: "#2d91ea";
radius: 8;
Text {
anchors.centerIn: parent;
color: "#ffffff";
text: "Repaint";
font.bold: true;
}
MouseArea {
anchors.fill: parent;
onPressed: {
button.color = "#1785e6"
}
onReleased: {
button.color = "#2d91ea"
chart_bar.repaint();
chart_doughnut.repaint();
chart_line.repaint();
chart_pie.repaint();
chart_polar.repaint();
chart_radar.repaint();
}
}
}
}
// /////////////////////////////////////////////////////////////////
// Body
// /////////////////////////////////////////////////////////////////
Grid {
id: layout;
x: 0;
y: 2*row_height + text_height;
width: parent.width;
height: parent.height - 2*row_height - text_height;
columns: 3;
spacing: chart_spacing;
Chart {
id: chart_line;
width: chart_width;
height: chart_height;
chartAnimated: true;
chartAnimationEasing: Easing.OutElastic;
chartAnimationDuration: 2000;
chartData: ChartsData.ChartLineData;
chartType: Charts.ChartType.LINE;
}
Chart {
id: chart_polar;
width: chart_width;
height: chart_height;
chartAnimated: true;
chartAnimationEasing: Easing.InBounce;
chartAnimationDuration: 2000;
chartData: ChartsData.ChartPolarData;
chartType: Charts.ChartType.POLAR;
}
Chart {
id: chart_radar;
width: chart_width;
height: chart_height;
chartAnimated: true;
chartAnimationEasing: Easing.OutBounce;
chartAnimationDuration: 2000;
chartData: ChartsData.ChartRadarData;
chartType: Charts.ChartType.RADAR;
}
Chart {
id: chart_pie;
width: chart_width;
height: chart_height;
chartAnimated: true;
chartAnimationEasing: Easing.Linear;
chartAnimationDuration: 2000;
chartData: ChartsData.ChartPieData;
chartType: Charts.ChartType.PIE;
}
Chart {
id: chart_bar;
width: chart_width;
height: chart_height;
chartAnimated: true;
chartAnimationEasing: Easing.OutBounce;
chartAnimationDuration: 2000;
chartData: ChartsData.ChartBarData;
chartType: Charts.ChartType.BAR;
}
Chart {
id: chart_doughnut;
width: chart_width;
height: chart_height;
chartAnimated: true;
chartAnimationEasing: Easing.OutElastic;
chartAnimationDuration: 2000;
chartData: ChartsData.ChartDoughnutData;
chartType: Charts.ChartType.DOUGHNUT;
}
}
}