tooltip.x position error on line chart
Using the customTooltips on line chart, the tooltip.x position is incorrect after the half of the chart. The behavour is visible also in the line-customTooltips.html example.
Looking at the standard tooltip behaviour I found that the position change is related to the tooltip position. After the half of the chart it moves on the other side of the dot. Like in the pie chart with the above/below value of yAlign. But there is no xAlign in the tooltip object and I can't find a way to mimic it. Any suggestion?
I experience the same issue. It might have something to do with responsiveness? With Chart.defaults.global.responsive = true; I notice a slight offset when hovering on the right side of the chart.
+1, same issue, responsive is not the problem... Any idea please ?
Experiencing this too, I have 4 tooltips and 3 and 4 are in the wrong x Position
+1 for wrong tooltip.x position and tooltip.width when hovering second half of the chart
The issue seems to come from that bit of code:
//Decide whether to align left or right based on position on canvas
if (this.x > this.chart.width/2){
this.x -= this.xOffset + this.width;
} else {
this.x += this.xOffset;
}
https://github.com/nnnick/Chart.js/blob/930b16a0af59201dcfcd1594b0e7540db4d04c9f/Chart.js#L1396-L1401
Removing that fixes the wrong tooltip.x problem, with the downside that the tooltip won't switch sides on the second half of the chart.
So it's not so much that the tooltip is positioned "incorrectly", it's just that the position gets offset on purpose. Ideally the x position would be constant across both half, and only the label would switch sides through some other means (separate offset, CSS, etc.).
Huzzah! The first alpha of Chart.js 2.0 has landed and should fix this issue. Check out the release and try it out! We've got a lot of momentum right now, so please help us test so we can launch 2.0 Gold by the end of the month. https://github.com/nnnick/Chart.js/releases/tag/v2.0-alpha
I'm closing this issue for now, but if you have implementation questions or find bugs, please create a jsfiddle and post the link here and we'll reopen this issue and get it fixed.