XY Chart Tooltip - Is possible to use the if condition in the expression?

My Embr-Charts module’s Chart.js component allows for totally custom tooltip content.

You can create callbacks that modify a section of the tooltip (title, body, footer, labels, etc.), or you go fully custom and create the entire tooltip yourself using the “External HTML Tooltip” functionality.

The contex parameter passed into the callback functions allows you to access the current hovered point (+ the rest of the chart’s properties), so you can choose what information you put on the tooltip.

The self parameter available in the callback is the Perspective component itself, which allows you access things like custom properties from within the callbacks.

I will say that this is fairly advanced and if you aren’t comfortable with Javascript you’ll probably have a bad time.

3 Likes