billboard.js
billboard.js copied to clipboard
How to know the source of a linked tooltip trigger
Description
Hey guys, I have two charts with linked tooltips. Is there a way to know which of the charts is the source of the tooltip trigger?
PS: Both charts tooltips are customized using the tooltip.content
option.
I don't know the way to know which chart is hovered.
It seems this
means the source Chart
object when the handler is called.
However it seems the handlers of both chart can be called.
I made an example to determine the instance were triggered the event. (open the devtool and checkout the console log)
tooltip: {
linked: true,
contents: function() {
if (this === currentInstance) {
// within this block, means from the current instance triggered the event
}
}
},
I see.
I don't know the way to know which chart is hovered.
let currentInstance = null; onover: function(event) { if (event.isTrusted) { currentInstance = this; } },