11'use strict' ;
22
3- import helpers from '../helpers/index' ;
3+ import { isFinite , valueOrDefault } from '../helpers/helpers.core' ;
4+ import { _parseFont } from '../helpers/helpers.options' ;
45import LinearScaleBase from './scale.linearbase' ;
56import Ticks from '../core/core.ticks' ;
67
@@ -12,18 +13,17 @@ const defaultConfig = {
1213
1314class LinearScale extends LinearScaleBase {
1415 determineDataLimits ( ) {
15- var me = this ;
16- var DEFAULT_MIN = 0 ;
17- var DEFAULT_MAX = 1 ;
18- var minmax = me . _getMinMax ( true ) ;
19- var min = minmax . min ;
20- var max = minmax . max ;
16+ const me = this ;
17+ const options = me . options ;
18+ const minmax = me . _getMinMax ( true ) ;
19+ let min = minmax . min ;
20+ let max = minmax . max ;
2121
22- me . min = helpers . isFinite ( min ) && ! isNaN ( min ) ? min : DEFAULT_MIN ;
23- me . max = helpers . isFinite ( max ) && ! isNaN ( max ) ? max : DEFAULT_MAX ;
22+ me . min = isFinite ( min ) ? min : valueOrDefault ( options . suggestedMin , 0 ) ;
23+ me . max = isFinite ( max ) ? max : valueOrDefault ( options . suggestedMax , 1 ) ;
2424
2525 // Backward compatible inconsistent min for stacked
26- if ( me . options . stacked && min > 0 ) {
26+ if ( options . stacked && min > 0 ) {
2727 me . min = 0 ;
2828 }
2929
@@ -39,7 +39,7 @@ class LinearScale extends LinearScaleBase {
3939 if ( me . isHorizontal ( ) ) {
4040 return Math . ceil ( me . width / 40 ) ;
4141 }
42- tickFont = helpers . options . _parseFont ( me . options . ticks ) ;
42+ tickFont = _parseFont ( me . options . ticks ) ;
4343 return Math . ceil ( me . height / tickFont . lineHeight ) ;
4444 }
4545
0 commit comments