@@ -31,7 +31,7 @@ Vue.component('chart-js-component', {
3131 } ,
3232 drawBarChart : function ( chartElement ) {
3333 const self = this ;
34- this . componentConfig [ "datasets" ] . forEach ( function ( item ) {
34+ this . props [ "datasets" ] . forEach ( function ( item ) {
3535 if ( item [ "backgroundColor" ] === undefined ) {
3636 item [ "backgroundColor" ] = self . getThemeColor ( "primary" )
3737 } else {
@@ -49,16 +49,16 @@ Vue.component('chart-js-component', {
4949 this . chartJsInstance = new Chart ( chartElement , {
5050 type : 'bar' ,
5151 data : {
52- labels : this . componentConfig [ "labels" ] ,
53- datasets : this . componentConfig [ "datasets" ]
52+ labels : this . props [ "labels" ] ,
53+ datasets : this . props [ "datasets" ]
5454 } ,
5555 options : {
5656 legend : {
57- display : this . componentConfig [ "display_legend" ] ,
57+ display : this . props [ "display_legend" ] ,
5858 } ,
5959 scales : {
6060 yAxes : [ {
61- display : this . componentConfig [ "display_y_axes" ] ,
61+ display : this . props [ "display_y_axes" ] ,
6262 gridLines : {
6363 display : false ,
6464 } ,
@@ -67,7 +67,7 @@ Vue.component('chart-js-component', {
6767 }
6868 } ] ,
6969 xAxes : [ {
70- display : this . componentConfig [ "display_x_axes" ] ,
70+ display : this . props [ "display_x_axes" ] ,
7171 gridLines : {
7272 display : false ,
7373 } ,
@@ -81,7 +81,7 @@ Vue.component('chart-js-component', {
8181 } ,
8282 drawLineChart : function ( chartElement ) {
8383 const self = this ;
84- this . componentConfig [ "datasets" ] . forEach ( function ( item ) {
84+ this . props [ "datasets" ] . forEach ( function ( item ) {
8585 if ( item [ "borderColor" ] === undefined ) {
8686 item [ "borderColor" ] = self . getThemeColor ( "primary" )
8787 } else {
@@ -95,16 +95,16 @@ Vue.component('chart-js-component', {
9595 this . chartJsInstance = new Chart ( chartElement , {
9696 type : 'line' ,
9797 data : {
98- labels : this . componentConfig [ "labels" ] ,
99- datasets : this . componentConfig [ "datasets" ]
98+ labels : this . props [ "labels" ] ,
99+ datasets : this . props [ "datasets" ]
100100 } ,
101101 options : {
102102 legend : {
103- display : this . componentConfig [ "display_legend" ] ,
103+ display : this . props [ "display_legend" ] ,
104104 } ,
105105 scales : {
106106 yAxes : [ {
107- display : this . componentConfig [ "display_y_axes" ] ,
107+ display : this . props [ "display_y_axes" ] ,
108108 gridLines : {
109109 display : false ,
110110 } ,
@@ -113,7 +113,7 @@ Vue.component('chart-js-component', {
113113 }
114114 } ] ,
115115 xAxes : [ {
116- display : this . componentConfig [ "display_x_axes" ] ,
116+ display : this . props [ "display_x_axes" ] ,
117117 gridLines : {
118118 display : false ,
119119 } ,
@@ -127,7 +127,7 @@ Vue.component('chart-js-component', {
127127 } ,
128128 drawDoughnutChart : function ( chartElement ) {
129129 const self = this ;
130- this . componentConfig [ "datasets" ] . forEach ( function ( item ) {
130+ this . props [ "datasets" ] . forEach ( function ( item ) {
131131 if ( item [ "backgroundColor" ] === undefined ) {
132132 item [ "backgroundColor" ] = self . getThemeColor ( "primary" )
133133 } else {
@@ -158,20 +158,20 @@ Vue.component('chart-js-component', {
158158 this . chartJsInstance = new Chart ( chartElement , {
159159 type : 'doughnut' ,
160160 data : {
161- labels : this . componentConfig [ "labels" ] ,
162- datasets : this . componentConfig [ "datasets" ]
161+ labels : this . props [ "labels" ] ,
162+ datasets : this . props [ "datasets" ]
163163 } ,
164164 options : {
165165 legend : {
166- display : this . componentConfig [ "display_legend" ] ,
166+ display : this . props [ "display_legend" ] ,
167167 } ,
168- cutoutPercentage : this . componentConfig [ "cutout_percentage" ]
168+ cutoutPercentage : this . props [ "cutout_percentage" ]
169169 }
170170 } ) ;
171171 } ,
172172 drawPieChart : function ( chartElement ) {
173173 const self = this ;
174- this . componentConfig [ "datasets" ] . forEach ( function ( item ) {
174+ this . props [ "datasets" ] . forEach ( function ( item ) {
175175 if ( item [ "backgroundColor" ] === undefined ) {
176176 item [ "backgroundColor" ] = self . getThemeColor ( "primary" )
177177 } else {
@@ -186,12 +186,12 @@ Vue.component('chart-js-component', {
186186 this . chartJsInstance = new Chart ( chartElement , {
187187 type : 'pie' ,
188188 data : {
189- labels : this . componentConfig [ "labels" ] ,
190- datasets : this . componentConfig [ "datasets" ]
189+ labels : this . props [ "labels" ] ,
190+ datasets : this . props [ "datasets" ]
191191 } ,
192192 options : {
193193 legend : {
194- display : this . componentConfig [ "display_legend" ] ,
194+ display : this . props [ "display_legend" ] ,
195195 }
196196 }
197197 } ) ;
@@ -211,16 +211,16 @@ Vue.component('chart-js-component', {
211211
212212 const chartElement = this . $refs . chart
213213
214- if ( this . componentConfig [ "type" ] == "bar" ) {
214+ if ( this . props [ "type" ] == "bar" ) {
215215 this . drawBarChart ( chartElement ) ;
216216 }
217- if ( this . componentConfig [ "type" ] == "line" ) {
217+ if ( this . props [ "type" ] == "line" ) {
218218 this . drawLineChart ( chartElement ) ;
219219 }
220- if ( this . componentConfig [ "type" ] == "doughnut" ) {
220+ if ( this . props [ "type" ] == "doughnut" ) {
221221 this . drawDoughnutChart ( chartElement ) ;
222222 }
223- if ( this . componentConfig [ "type" ] == "pie" ) {
223+ if ( this . props [ "type" ] == "pie" ) {
224224 this . drawPieChart ( chartElement ) ;
225225 }
226226
0 commit comments