Willy Mularto
Willy Mularto

Reputation: 1441

how to customize data series label/tooltips with flot graph

By default the data series info/tooltips in flot graph looks like "legend_title of 2.00 = 1234567890.00" Is it possible to remove the .00 or customize to other format? Thanks

Upvotes: 1

Views: 626

Answers (1)

Mark
Mark

Reputation: 108537

Flot doesn't really provide a "built in" tooltip but rather a way to create your own tooltips. From your question, I gather you are following the example here. If you want to customize what the tooltip says just call the showTooltip function with a different "contents".

For instance, To drop the zero's off the numbers call it as:

showTooltip(item.pageX, item.pageY,
   item.series.label + " of " + x.toFixed(0) + " = " + y.toFixed(0));

But you can further format it any way you want!

Upvotes: 2

Related Questions