Replies: 3 comments
-
https://www.chartjs.org/docs/latest/api/classes/Chart.html#getactiveelements |
Beta Was this translation helpful? Give feedback.
-
No matter what I do, I can't get this to work. Isn't there any tutorial out there on how to do this in 3.6? |
Beta Was this translation helpful? Give feedback.
-
@Ic3m4n34 It's late to the party but for the sake of demonstrating what the maintainer means by leaving the confusing typescript definition. This is something he means in terms of plugin. beforeDraw or afterDraw: (chart) => {
const activeEle = chart.getActiveElements();
if (activeEle.length <= 0) return;
const { ctx, scales } = chart;
const { x } = activeEle[0].element;
const topY = scales.y.top;
const bottomY = scales.y.bottom;
// draw vertical line
ctx.save();
ctx.setLineDash([1, 1]);
ctx.beginPath();
ctx.moveTo(x, topY);
ctx.lineTo(x, bottomY);
ctx.lineWidth = 1;
ctx.strokeStyle = '#424242';
ctx.stroke();
ctx.restore();
}, This lib probably has the one of most confusing typescript definitions due to the constant changing apis in different versions. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
With latest version 3.5.1, this code, which worked in 3.5.0, doesn't work anymore:
How do I get the active tooltip?
Beta Was this translation helpful? Give feedback.
All reactions