Closed tiefpunkt closed 10 years ago
The plugin is reading data from the wrong place.
Replace line 218 with
if (typeof item.series.threshold === "undefined") {
@wq9 no, it is more complicated, tooltip needs to support many different plugins, if that really solves this problem, then just add new if
statement with steps === true
and then read data from correct place. pull request is always welcome :)
I think you wrote the wrong if statement, the correct one is below:
// for threshold plugin we need to read data from different place
if (typeof item.series.threshold === "undefined") {
//no threshold plugin, read hovered data point
x = item.datapoint[0];
y = item.datapoint[1];
} else {
//threshold plugin in use, read data from source using index
x = item.series.data[item.dataIndex][0];
y = item.series.data[item.dataIndex][1];
}
Or you can swap the stuff inside the if...else. That would be better.
// for threshold plugin we need to read data from different place
if (typeof item.series.threshold !== "undefined") {
//threshold plugin in use, read data from source using index
x = item.series.data[item.dataIndex][0];
y = item.series.data[item.dataIndex][1];
} else {
//no threshold plugin, read hovered data point
x = item.datapoint[0];
y = item.datapoint[1];
}
should be fixed after merging #78
When using the steps option in flot, as below, tooltips are not assigned to the correct datapoints.
This is probably due to the fact that flot adds additional datapoints to the graph when steps is set to true. Ideally, flot.tooltip should ignore them, and only show tooltips on the "real" datapoints.