@@ -4,22 +4,34 @@ $(function() {
44
55 if ( ! $dashboardSalesBreakdownChart . length ) {
66 return false ;
7- }
7+ }
88
9- Morris . Donut ( {
10- element : 'dashboard-sales-breakdown-chart' ,
11- data : [ { label : "Download Sales" , value : 12 } ,
12- { label : "In-Store Sales" , value : 30 } ,
13- { label : "Mail-Order Sales" , value : 20 } ] ,
14- resize : true ,
15- colors : [
16- tinycolor ( config . colorPrimary . toString ( ) ) . lighten ( 10 ) . toString ( ) ,
17- tinycolor ( config . colorPrimary . toString ( ) ) . darken ( 8 ) . toString ( ) ,
18- config . colorPrimary . toString ( )
19- ] ,
20- } ) ;
9+ function drawSalesChart ( ) {
10+
11+ $dashboardSalesBreakdownChart . html ( '' ) ;
12+
13+ Morris . Donut ( {
14+ element : 'dashboard-sales-breakdown-chart' ,
15+ data : [ { label : "Download Sales" , value : 12 } ,
16+ { label : "In-Store Sales" , value : 30 } ,
17+ { label : "Mail-Order Sales" , value : 20 } ] ,
18+ resize : true ,
19+ colors : [
20+ tinycolor ( config . colorPrimary . toString ( ) ) . lighten ( 10 ) . toString ( ) ,
21+ tinycolor ( config . colorPrimary . toString ( ) ) . darken ( 8 ) . toString ( ) ,
22+ config . colorPrimary . toString ( )
23+ ] ,
24+ } ) ;
2125
22- var $sameheightContainer = $dashboardSalesBreakdownChart . closest ( ".sameheight-container" ) ;
26+ var $sameheightContainer = $dashboardSalesBreakdownChart . closest ( ".sameheight-container" ) ;
2327
24- setSameHeights ( $sameheightContainer ) ;
28+ setSameHeights ( $sameheightContainer ) ;
29+ }
30+
31+ drawSalesChart ( ) ;
32+
33+ watch ( config , "colorPrimary" , function ( ) {
34+ drawSalesChart ( ) ;
35+ } ) ;
36+
2537} )
0 commit comments