custumize tooltip in chart

I have the distance vs time chart in my project and I want to show speed on tooltip by calculating the speed.how can I do this.? any operator works in tooltip string? I have to show the distance/time(formula) value on tooltip

Hi,

have you looked at the
Charts demos
? A lot of the examples there on how to use different types of Tooltips. The details depend on your data, but in a simple scenario you should be able to do something like

Tooltip tooltip = new Tooltip();
tooltip.setFormatter("'Speed:' + (this.y / this.x)");
chart.getConfiguration().setTooltip(tooltip);

Hope this helps!

Olli Tietäväinen
Vaadin Developer

Addenum: Take a look at the
Highcharts API for the Tooltip formatter
if you want to see what’s available for you in the formatter function.

Thanks Olli.
It works.!