I want to show the tooltip of some dot based on its value, for example if i click on the button, i want to call the function that gets the dot on my line chart based on its value, and then displays tooltip of that dot without me having to hover over that dot or even line chart.
I tried:
showTooltipByValue(value: number) {
const index = this.chartPotrosnjaDanas.data.datasets[0].data.indexOf(value);
if (index >= 0) {
const meta = this.chartPotrosnjaDanas.getDatasetMeta(0).data[index];
const xScale = this.chartPotrosnjaDanas.scales['x-axis-0'];
console.log(xScale);
const yScale = this.chartPotrosnjaDanas.scales['y-axis-0'];
const x = xScale.getPixelForValue(meta._model.x);
console.log(x);
const y = yScale.getPixelForValue(meta._model.y);
const event = new MouseEvent('mousemove', { clientX: x, clientY: y });
this.chartPotrosnjaDanas.canvas.dispatchEvent(event);
}
}
but this didnt work at all