var helpers = require('../helpers/index');
var Ticks = require('./core.ticks');
+var isArray = helpers.isArray;
+var isNullOrUndef = helpers.isNullOrUndef;
var valueOrDefault = helpers.valueOrDefault;
var valueAtIndexOrDefault = helpers.valueAtIndexOrDefault;
lineHeight = tickFont.lineHeight;
width = height = 0;
// Undefined labels and arrays should not be measured
- if (!helpers.isNullOrUndef(label) && !helpers.isArray(label)) {
+ if (!isNullOrUndef(label) && !isArray(label)) {
width = helpers.measureText(ctx, cache.data, cache.gc, width, label);
height = lineHeight;
- } else if (helpers.isArray(label)) {
+ } else if (isArray(label)) {
// if it is an array let's measure each element
for (j = 0, jlen = label.length; j < jlen; ++j) {
nestedLabel = label[j];
// Undefined labels and arrays should not be measured
- if (!helpers.isNullOrUndef(nestedLabel) && !helpers.isArray(nestedLabel)) {
+ if (!isNullOrUndef(nestedLabel) && !isArray(nestedLabel)) {
width = helpers.measureText(ctx, cache.data, cache.gc, width, nestedLabel);
height += lineHeight;
}
afterBuildTicks: function(ticks) {
var me = this;
// ticks is empty for old axis implementations here
- if (helpers.isArray(ticks) && ticks.length) {
+ if (isArray(ticks) && ticks.length) {
return helpers.callback(me.options.afterBuildTicks, [me, ticks]);
}
// Support old implementations (that modified `this.ticks` directly in buildTicks)
// 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
getRightValue: function(rawValue) {
// Null and undefined values first
- if (helpers.isNullOrUndef(rawValue)) {
+ if (isNullOrUndef(rawValue)) {
return NaN;
}
// isNaN(object) returns true, so make sure NaN is checking for a number; Discard Infinite values
_parseValue: function(value) {
var start, end, min, max;
- if (helpers.isArray(value)) {
+ if (isArray(value)) {
start = +this.getRightValue(value[0]);
end = +this.getRightValue(value[1]);
min = Math.min(start, end);
label = tick.label;
// autoskipper skipped this tick (#4635)
- if (helpers.isNullOrUndef(label) && i < ticks.length) {
+ if (isNullOrUndef(label) && i < ticks.length) {
continue;
}
label = tick.label;
// autoskipper skipped this tick (#4635)
- if (helpers.isNullOrUndef(label)) {
+ if (isNullOrUndef(label)) {
continue;
}
pixel = me.getPixelForTick(i) + optionTicks.labelOffset;
font = tick.major ? fonts.major : fonts.minor;
lineHeight = font.lineHeight;
- lineCount = helpers.isArray(label) ? label.length : 1;
+ lineCount = isArray(label) ? label.length : 1;
if (isHorizontal) {
x = pixel;
label = item.label;
y = item.textOffset;
- if (helpers.isArray(label)) {
+ if (isArray(label)) {
for (j = 0, jlen = label.length; j < jlen; ++j) {
// We just make sure the multiline element is a string here..
ctx.fillText('' + label[j], 0, y);