0👍
First off you need to access curent Chart
instance. I have fond this GitHub issue, in which author states that current instance is saved in this.$data._chart
.
Then you should call getElementsAtEvent
method of instance, passing an event
as the first argument.
Calling
getElementsAtEvent(event)
on your Chart instance passing an
argument of anevent
, or jQueryevent
, will return the point elements
that are at that the same position of that event. This functionality
may be useful for implementing DOM based tooltips, or triggering
custom behaviour in your application.
this.$data._chart.getElementsAtEvent(event);
Then, implement your custom login, depending on the returned value of that method (if you are using Vue Router: this.$router.push("/path/to/redirect");
).
- [Chartjs]-Chart js 2 how to set bar width
- [Chartjs]-Chartjs 2.7.3: Set Y data at the correct X position axis