me.updateSharedOptions(sharedOptions, mode, firstOpts);
for (let i = start; i < start + count; i++) {
- const vpixels = reset ? {base, head: base} : me._calculateBarValuePixels(i);
+ const parsed = me.getParsed(i);
+ const vpixels = reset || isNullOrUndef(parsed[vScale.axis]) ? {base, head: base} : me._calculateBarValuePixels(i);
const ipixels = me._calculateBarIndexPixels(i, ruler);
const properties = {
import DatasetController from '../core/core.datasetController';
+import {isNullOrUndef} from '../helpers';
import {_limitValue, isNumber} from '../helpers/helpers.math';
import {_lookupByKey} from '../helpers/helpers.collection';
const point = points[i];
const parsed = me.getParsed(i);
const properties = directUpdate ? point : {};
+ const nullData = isNullOrUndef(parsed.y);
const x = properties.x = xScale.getPixelForValue(parsed.x, i);
- const y = properties.y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(_stacked ? me.applyStack(yScale, parsed, _stacked) : parsed.y, i);
- properties.skip = isNaN(x) || isNaN(y);
+ const y = properties.y = reset || nullData ? yScale.getBasePixel() : yScale.getPixelForValue(_stacked ? me.applyStack(yScale, parsed, _stacked) : parsed.y, i);
+ properties.skip = isNaN(x) || isNaN(y) || nullData;
properties.stop = i > 0 && (parsed.x - prevParsed.x) > maxGapLength;
properties.parsed = parsed;
expect(meta.controller.index).toBe(0);
});
+ it('should set null bars to the reset state', function() {
+ var chart = window.acquireChart({
+ type: 'bar',
+ data: {
+ datasets: [{
+ data: [10, null, 0, -4],
+ label: 'dataset1',
+ }],
+ labels: ['label1', 'label2', 'label3', 'label4']
+ }
+ });
+
+ var meta = chart.getDatasetMeta(0);
+ var bar = meta.data[1];
+ var {x, y, base} = bar.getProps(['x', 'y', 'base'], true);
+ expect(isNaN(x)).toBe(false);
+ expect(isNaN(y)).toBe(false);
+ expect(isNaN(base)).toBe(false);
+ });
+
it('should use the first scale IDs if the dataset does not specify them', function() {
var chart = window.acquireChart({
type: 'bar',
}
expect(createChart).not.toThrow();
});
+
+ it('should set skipped points to the reset state', function() {
+ var chart = window.acquireChart({
+ type: 'line',
+ data: {
+ datasets: [{
+ data: [10, null, 0, -4],
+ label: 'dataset1',
+ pointBorderWidth: [1, 2, 3, 4]
+ }],
+ labels: ['label1', 'label2', 'label3', 'label4']
+ }
+ });
+
+ var meta = chart.getDatasetMeta(0);
+ var point = meta.data[1];
+ var {x, y} = point.getProps(['x', 'y'], true);
+ expect(point.skip).toBe(true);
+ expect(isNaN(x)).toBe(false);
+ expect(isNaN(y)).toBe(false);
+ });
});