@@ -9,6 +9,7 @@ import Chart from 'chart.js';
9
9
export class ChartsPage {
10
10
@ViewChild ( 'barCanvas' ) barCanvas ;
11
11
@ViewChild ( 'doughnutCanvas' ) doughnutCanvas ;
12
+ @ViewChild ( 'halfDoughnutCanvas' ) halfDoughnutCanvas ;
12
13
@ViewChild ( 'lineCanvas' ) lineCanvas ;
13
14
@ViewChild ( 'radarCanvas' ) radarCanvas ;
14
15
@ViewChild ( 'polarCanvas' ) polarCanvas ;
@@ -18,6 +19,7 @@ export class ChartsPage {
18
19
19
20
barChart : any ;
20
21
doughnutChart : any ;
22
+ halfDoughnutChart : any ;
21
23
lineChart : any ;
22
24
radarChart : any ;
23
25
polarAreaChart : any ;
@@ -30,6 +32,7 @@ export class ChartsPage {
30
32
ionViewDidLoad ( ) {
31
33
this . barChart = this . getBarChart ( ) ;
32
34
this . doughnutChart = this . getDoughnutChart ( ) ;
35
+ this . halfDoughnutChart = this . getHalfDoughnutChart ( ) ;
33
36
this . lineChart = this . getLineChart ( ) ;
34
37
this . radarChart = this . getRadarChart ( ) ;
35
38
@@ -202,6 +205,32 @@ export class ChartsPage {
202
205
return this . getChart ( this . doughnutCanvas . nativeElement , "doughnut" , data ) ;
203
206
}
204
207
208
+ getHalfDoughnutChart ( ) {
209
+ let data = {
210
+ labels : [ "Red" , "Blue" , "Yellow" , "Green" , "Purple" , "Orange" ] ,
211
+ datasets : [ {
212
+ label : '# of Votes' ,
213
+ data : [ 12 , 19 , 3 , 5 , 2 , 3 ] ,
214
+ backgroundColor : [
215
+ 'rgba(255, 99, 132, 0.2)' ,
216
+ 'rgba(54, 162, 235, 0.2)' ,
217
+ 'rgba(255, 206, 86, 0.2)' ,
218
+ 'rgba(75, 192, 192, 0.2)' ,
219
+ 'rgba(153, 102, 255, 0.2)' ,
220
+ 'rgba(255, 159, 64, 0.2)'
221
+ ] ,
222
+ hoverBackgroundColor : [ "#FF6384" , "#36A2EB" , "#FFCE56" , "#FF6384" , "#36A2EB" , "#FFCE56" ]
223
+ } ]
224
+ } ;
225
+
226
+ let options = {
227
+ circumference : Math . PI ,
228
+ rotation : 1.0 * Math . PI
229
+ }
230
+
231
+ return this . getChart ( this . halfDoughnutCanvas . nativeElement , "doughnut" , data , options ) ;
232
+ }
233
+
205
234
getBarChart ( ) {
206
235
let data = {
207
236
labels : [ "Red" , "Blue" , "Yellow" , "Green" , "Purple" , "Orange" ] ,
0 commit comments