Fix filling between datasets of different lengths

This commit is contained in:
Simon Brunel
2017-06-10 13:52:37 +02:00
committed by Evert Timberg
parent 9e6a6112a4
commit 5e58114848
5 changed files with 7 additions and 6 deletions

View File

@@ -19,9 +19,10 @@ module.exports = function(Chart) {
var meta = chart.getDatasetMeta(index);
var visible = meta && chart.isDatasetVisible(index);
var points = (visible && meta.dataset._children) || [];
var length = points.length || 0;
return !points.length? null : function(point, i) {
return points[i]._view || null;
return !length? null : function(point, i) {
return (i < length && points[i]._view) || null;
};
},

View File

@@ -13,7 +13,7 @@
"fill": "+1"
}, {
"backgroundColor": "rgba(0, 0, 255, 0.25)",
"data": [0, 2, 0, -2, 0, 2, 0, null, null],
"data": [0, 2, 0, -2, 0, 2, 0],
"fill": 3
}, {
"backgroundColor": "rgba(255, 0, 255, 0.25)",

View File

@@ -13,7 +13,7 @@
"fill": "+1"
}, {
"backgroundColor": "rgba(0, 0, 255, 0.25)",
"data": [0, 2, 0, -2, 0, 2, 0, null, null],
"data": [0, 2, 0, -2, 0, 2, 0],
"fill": 3
}, {
"backgroundColor": "rgba(255, 0, 255, 0.25)",

View File

@@ -13,7 +13,7 @@
"fill": "+1"
}, {
"backgroundColor": "rgba(0, 0, 255, 0.25)",
"data": [0, 2, 0, -2, 0, 2, 0, null, null],
"data": [0, 2, 0, -2, 0, 2, 0],
"fill": 3
}, {
"backgroundColor": "rgba(255, 0, 255, 0.25)",

View File

@@ -13,7 +13,7 @@
"fill": "+1"
}, {
"backgroundColor": "rgba(0, 0, 255, 0.25)",
"data": [0, 2, 0, -2, 0, 2, 0, null, null],
"data": [0, 2, 0, -2, 0, 2, 0],
"fill": 3
}, {
"backgroundColor": "rgba(255, 0, 255, 0.25)",