File tree Expand file tree Collapse file tree 2 files changed +19
-10
lines changed
src/pages/miscellaneous/charts Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change 7
7
</ ion-header >
8
8
< ion-content >
9
9
< ion-card >
10
+ < button ion-button (click) ="updateData() "> Update Pie Chart Data</ button >
11
+ < ion-card >
12
+ < ion-card-header >
13
+ Pie Chart
14
+ </ ion-card-header >
15
+ < ion-card-content >
16
+ < canvas #pieCanvas > </ canvas >
17
+ </ ion-card-content >
18
+ </ ion-card >
10
19
< ion-card-header >
11
20
Bar Chart
12
21
</ ion-card-header >
46
55
< canvas #polarCanvas > </ canvas >
47
56
</ ion-card-content >
48
57
</ ion-card >
49
- < ion-card >
50
- < ion-card-header >
51
- Pie Chart
52
- </ ion-card-header >
53
- < ion-card-content >
54
- < canvas #pieCanvas > </ canvas >
55
- </ ion-card-content >
56
- </ ion-card >
57
58
< ion-card >
58
59
< ion-card-header >
59
60
Bubble Chart
70
71
< canvas #mixedCanvas > </ canvas >
71
72
</ ion-card-content >
72
73
</ ion-card >
73
- </ ion-content >
74
+ </ ion-content >
Original file line number Diff line number Diff line change @@ -32,10 +32,18 @@ export class ChartsPage {
32
32
this . doughnutChart = this . getDoughnutChart ( ) ;
33
33
this . lineChart = this . getLineChart ( ) ;
34
34
this . radarChart = this . getRadarChart ( ) ;
35
- this . pieChart = this . getPieChart ( ) ;
35
+
36
36
this . polarAreaChart = this . getPolarAreaChart ( ) ;
37
37
this . bubbleChart = this . getBubbleChart ( ) ;
38
38
this . mixedChart = this . getMixedChart ( ) ;
39
+ this . pieChart = this . getPieChart ( ) ;
40
+ }
41
+
42
+ updateData ( ) {
43
+ // After instantiating your chart, its data is accessible and can be changed anytime with the function update().
44
+ // It takes care of everything and even redraws the animations :D
45
+ this . pieChart . data . datasets [ 0 ] . data = [ Math . random ( ) * 1000 , Math . random ( ) * 1000 , Math . random ( ) * 1000 ] ;
46
+ this . pieChart . update ( ) ;
39
47
}
40
48
41
49
getChart ( context , chartType , data , options ?) {
You can’t perform that action at this time.
0 commit comments