Create an interaction mode, that will be the point interaction + index interaction #11148
Unanswered
victorkardel
asked this question in
Q&A
Replies: 2 comments 2 replies
-
@vcctm you should create a custom interaction which should invoke the point interaction, and if the result is empty then invoke the index one. Here is the code: Interaction.modes.pointIndex = function(chart, e, options, useFinalPosition) {
const pointItems = Interaction.modes.point(chart, e, {axis: 'xy', intersect: true}, useFinalPosition);
if (!pointItems.length) {
return Chart.Interaction.modes.index(chart, e, {axis: 'x', intersect: false}, useFinalPosition);
}
return pointItems;
}; Here is the codepen to see it in action: https://codepen.io/stockinail/pen/ExeomVx |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want help to create a interaction mode for tooltip.
When the user hover to an exact point will show the data for this point like that.
And everywhere else that is not a exactly point show index mode interaction:
Any one ever had to do something like that ?
Beta Was this translation helpful? Give feedback.
All reactions