mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-07 04:39:06 +02:00
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:
parent
f2270ed8db
commit
72f423fb95
@ -117,9 +117,11 @@ module.exports = function(Chart) {
|
||||
var x = 0,
|
||||
y = 0;
|
||||
for (i = 0; i < xPositions.length; ++i) {
|
||||
if (xPositions[ i ]) {
|
||||
x += xPositions[i];
|
||||
y += yPositions[i];
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
x: Math.round(x / xPositions.length),
|
||||
|
Loading…
Reference in New Issue
Block a user