Skip to content

Commit

Permalink
Make isNullOrUndef global
Browse files Browse the repository at this point in the history
  • Loading branch information
nagix committed Jun 12, 2019
1 parent a1c6fac commit 1c0d879
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/scales/scale.category.js
Expand Up @@ -3,6 +3,8 @@
var helpers = require('../helpers/index');
var Scale = require('../core/core.scale');

var isNullOrUndef = helpers.isNullOrUndef;

var defaultConfig = {
position: 'bottom'
};
Expand Down Expand Up @@ -73,13 +75,13 @@ module.exports = Scale.extend({
var valueDimension = (isHorizontal ? me.width : me.height) / offsetAmt;
var valueCategory, labels, idx, pixel;

if (!helpers.isNullOrUndef(index) && !helpers.isNullOrUndef(datasetIndex)) {
if (!isNullOrUndef(index) && !isNullOrUndef(datasetIndex)) {
value = me.chart.data.datasets[datasetIndex].data[index];
}

// If value is a data object, then index is the index in the data array,
// not the index of the scale. We need to change that.
if (!helpers.isNullOrUndef(value)) {
if (!isNullOrUndef(value)) {
valueCategory = isHorizontal ? value.x : value.y;
}
if (valueCategory !== undefined || (value !== undefined && isNaN(index))) {
Expand Down

0 comments on commit 1c0d879

Please sign in to comment.