Fix tooltip not shown for missing dataset

When two datasets are shown and they don't have the same x-coordinates, then the position of the tooltip is not calculated correctly, when using mode 'label' or 'dataset'. This fix checks if the position of every dataset exists, before it is used.
This commit is contained in:
André Wallat 2016-06-16 13:20:54 +02:00 committed by Andre Wallat
parent f2270ed8db
commit 72f423fb95

View File

@ -117,8 +117,10 @@ module.exports = function(Chart) {
var x = 0, var x = 0,
y = 0; y = 0;
for (i = 0; i < xPositions.length; ++i) { for (i = 0; i < xPositions.length; ++i) {
x += xPositions[i]; if (xPositions[ i ]) {
y += yPositions[i]; x += xPositions[i];
y += yPositions[i];
}
} }
return { return {