@@ -5,6 +5,8 @@ var Element = require('./core.element');
55var helpers = require ( '../helpers/index' ) ;
66var Ticks = require ( './core.ticks' ) ;
77
8+ var isArray = helpers . isArray ;
9+ var isNullOrUndef = helpers . isNullOrUndef ;
810var valueOrDefault = helpers . valueOrDefault ;
911var valueAtIndexOrDefault = helpers . valueAtIndexOrDefault ;
1012
@@ -125,15 +127,15 @@ function computeLabelSizes(ctx, tickFonts, ticks, caches) {
125127 lineHeight = tickFont . lineHeight ;
126128 width = height = 0 ;
127129 // Undefined labels and arrays should not be measured
128- if ( ! helpers . isNullOrUndef ( label ) && ! helpers . isArray ( label ) ) {
130+ if ( ! isNullOrUndef ( label ) && ! isArray ( label ) ) {
129131 width = helpers . measureText ( ctx , cache . data , cache . gc , width , label ) ;
130132 height = lineHeight ;
131- } else if ( helpers . isArray ( label ) ) {
133+ } else if ( isArray ( label ) ) {
132134 // if it is an array let's measure each element
133135 for ( j = 0 , jlen = label . length ; j < jlen ; ++ j ) {
134136 nestedLabel = label [ j ] ;
135137 // Undefined labels and arrays should not be measured
136- if ( ! helpers . isNullOrUndef ( nestedLabel ) && ! helpers . isArray ( nestedLabel ) ) {
138+ if ( ! isNullOrUndef ( nestedLabel ) && ! isArray ( nestedLabel ) ) {
137139 width = helpers . measureText ( ctx , cache . data , cache . gc , width , nestedLabel ) ;
138140 height += lineHeight ;
139141 }
@@ -438,7 +440,7 @@ var Scale = Element.extend({
438440 afterBuildTicks : function ( ticks ) {
439441 var me = this ;
440442 // ticks is empty for old axis implementations here
441- if ( helpers . isArray ( ticks ) && ticks . length ) {
443+ if ( isArray ( ticks ) && ticks . length ) {
442444 return helpers . callback ( me . options . afterBuildTicks , [ me , ticks ] ) ;
443445 }
444446 // Support old implementations (that modified `this.ticks` directly in buildTicks)
@@ -645,7 +647,7 @@ var Scale = Element.extend({
645647 // Get the correct value. NaN bad inputs, If the value type is object get the x or y based on whether we are horizontal or not
646648 getRightValue : function ( rawValue ) {
647649 // Null and undefined values first
648- if ( helpers . isNullOrUndef ( rawValue ) ) {
650+ if ( isNullOrUndef ( rawValue ) ) {
649651 return NaN ;
650652 }
651653 // isNaN(object) returns true, so make sure NaN is checking for a number; Discard Infinite values
@@ -689,7 +691,7 @@ var Scale = Element.extend({
689691 _parseValue : function ( value ) {
690692 var start , end , min , max ;
691693
692- if ( helpers . isArray ( value ) ) {
694+ if ( isArray ( value ) ) {
693695 start = + this . getRightValue ( value [ 0 ] ) ;
694696 end = + this . getRightValue ( value [ 1 ] ) ;
695697 min = Math . min ( start , end ) ;
@@ -944,7 +946,7 @@ var Scale = Element.extend({
944946 label = tick . label ;
945947
946948 // autoskipper skipped this tick (#4635)
947- if ( helpers . isNullOrUndef ( label ) && i < ticks . length ) {
949+ if ( isNullOrUndef ( label ) && i < ticks . length ) {
948950 continue ;
949951 }
950952
@@ -1035,14 +1037,14 @@ var Scale = Element.extend({
10351037 label = tick . label ;
10361038
10371039 // autoskipper skipped this tick (#4635)
1038- if ( helpers . isNullOrUndef ( label ) ) {
1040+ if ( isNullOrUndef ( label ) ) {
10391041 continue ;
10401042 }
10411043
10421044 pixel = me . getPixelForTick ( i ) + optionTicks . labelOffset ;
10431045 font = tick . major ? fonts . major : fonts . minor ;
10441046 lineHeight = font . lineHeight ;
1045- lineCount = helpers . isArray ( label ) ? label . length : 1 ;
1047+ lineCount = isArray ( label ) ? label . length : 1 ;
10461048
10471049 if ( isHorizontal ) {
10481050 x = pixel ;
@@ -1173,7 +1175,7 @@ var Scale = Element.extend({
11731175
11741176 label = item . label ;
11751177 y = item . textOffset ;
1176- if ( helpers . isArray ( label ) ) {
1178+ if ( isArray ( label ) ) {
11771179 for ( j = 0 , jlen = label . length ; j < jlen ; ++ j ) {
11781180 // We just make sure the multiline element is a string here..
11791181 ctx . fillText ( '' + label [ j ] , 0 , y ) ;
0 commit comments