Vaadin Charts Tooltip Format

888 views Asked by At

The following is the formatter I am using.

 Tooltip tooltip = new Tooltip();
 tooltip.setxDateFormat("MMM dd, YYYY");
 tooltip.setFormatter("function()  { var d = new Date(this.x);" + "return " + "'<b>'+this.series.name +'</b><br/>"
                + "<strong>Value :</strong> '+ this.y +'<br/>" + "<strong>Start Date :</strong> '+ this.x; " + "}");

 chartConfig.setTooltip(tooltip);

This is the tooltip I am getting

How to:

1) Round of value with two decimal places

2) Using Date Format like Nov 30, 2016

Kindly assist.

1

There are 1 answers

0
Henri Kerola On BEST ANSWER

Vaadin Charts uses Highcharts on the client side, which means that you can use Highcharts JS APIs for formatting, the following calls should work:

Highcharts.numberFormat(this.y, 2)

Highcharts.dateFormat('%b %d %Y', new Date(this.x))