File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -80,25 +80,21 @@ function mergeScaleConfig(config, options) {
8080 return scales ;
8181}
8282
83- function initOptions ( config , options ) {
84- options = options || { } ;
83+ function initOptions ( config ) {
84+ const options = config . options || ( config . options = { } ) ;
8585
8686 options . plugins = valueOrDefault ( options . plugins , { } ) ;
8787 options . scales = mergeScaleConfig ( config , options ) ;
88-
89- return options ;
9088}
9189
9290function initConfig ( config ) {
9391 config = config || { } ;
9492
95- // Do NOT use mergeConfig for the data object because this method merges arrays
96- // and so would change references to labels and datasets, preventing data updates.
9793 const data = config . data = config . data || { datasets : [ ] , labels : [ ] } ;
9894 data . datasets = data . datasets || [ ] ;
9995 data . labels = data . labels || [ ] ;
10096
101- config . options = initOptions ( config , config . options ) ;
97+ initOptions ( config ) ;
10298
10399 return config ;
104100}
@@ -150,14 +146,18 @@ export default class Config {
150146 return this . _config . options ;
151147 }
152148
149+ set options ( options ) {
150+ this . _config . options = options ;
151+ }
152+
153153 get plugins ( ) {
154154 return this . _config . plugins ;
155155 }
156156
157- update ( options ) {
157+ update ( ) {
158158 const config = this . _config ;
159159 this . clearCache ( ) ;
160- config . options = initOptions ( config , options ) ;
160+ initOptions ( config ) ;
161161 }
162162
163163 clearCache ( ) {
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ class Chart {
159159 }
160160
161161 set options ( options ) {
162- this . config . update ( options ) ;
162+ this . config . options = options ;
163163 }
164164
165165 /**
@@ -444,7 +444,7 @@ class Chart {
444444 const me = this ;
445445 const config = me . config ;
446446
447- config . update ( config . options ) ;
447+ config . update ( ) ;
448448 me . _options = config . createResolver ( config . chartOptionScopes ( ) , me . getContext ( ) ) ;
449449
450450 each ( me . scales , ( scale ) => {
You can’t perform that action at this time.
0 commit comments