@@ -243,14 +243,14 @@ var Scale = Element.extend({
243
243
/**
244
244
* @param {number } maxWidth - the max width in pixels
245
245
* @param {number } maxHeight - the max height in pixels
246
- * @param {object } margins - the space between the edge of the scale and edge of the chart
246
+ * @param {object } margins - the space between the edge of the other scales and edge of the chart
247
247
* This space comes from two sources:
248
248
* - padding - space that's required to show the labels at the edges of the scale
249
249
* - thickness of scales or legends in another orientation
250
250
*/
251
251
update : function ( maxWidth , maxHeight , margins ) {
252
252
var me = this ;
253
- var optionTicks = me . options . ticks ;
253
+ var tickOpts = me . options . ticks ;
254
254
var i , ilen , labels , ticks ;
255
255
256
256
// Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
@@ -301,6 +301,13 @@ var Scale = Element.extend({
301
301
} else {
302
302
// Support old implementations (that modified `this.ticks` directly in buildTicks)
303
303
me . ticks = me . afterBuildTicks ( me . ticks ) ;
304
+ ticks = [ ] ;
305
+ for ( i = 0 , ilen = me . ticks . length ; i < ilen ; ++ i ) {
306
+ ticks . push ( {
307
+ value : me . ticks [ i ] ,
308
+ major : false
309
+ } ) ;
310
+ }
304
311
}
305
312
306
313
me . beforeTickToLabelConversion ( ) ;
@@ -312,20 +319,9 @@ var Scale = Element.extend({
312
319
313
320
me . afterTickToLabelConversion ( ) ;
314
321
322
+ // IMPORTANT: below this point, we consider that `this.ticks` will NEVER change!
315
323
me . ticks = labels ; // BACKWARD COMPATIBILITY
316
324
317
- // IMPORTANT: from this point, we consider that `this.ticks` will NEVER change!
318
-
319
- if ( ! ticks ) {
320
- ticks = [ ] ;
321
- for ( i = 0 , ilen = labels . length ; i < ilen ; ++ i ) {
322
- ticks . push ( {
323
- value : me . ticks [ i ] ,
324
- major : false
325
- } ) ;
326
- }
327
- }
328
-
329
325
// BACKWARD COMPAT: synchronize `_ticks` with labels (so potentially `this.ticks`)
330
326
for ( i = 0 , ilen = labels . length ; i < ilen ; ++ i ) {
331
327
ticks [ i ] . label = labels [ i ] ;
@@ -342,7 +338,7 @@ var Scale = Element.extend({
342
338
me . fit ( ) ;
343
339
me . afterFit ( ) ;
344
340
// Auto-skip
345
- me . _ticks = optionTicks . display && optionTicks . autoSkip ? me . _autoSkip ( me . getTicks ( ) ) : me . getTicks ( ) ;
341
+ me . _ticks = tickOpts . display && tickOpts . autoSkip ? me . _autoSkip ( me . getTicks ( ) ) : me . getTicks ( ) ;
346
342
347
343
me . afterUpdate ( ) ;
348
344
0 commit comments