Reputation: 665
I have a chart in Vaadin 8 with the following formatter for y axis labels:
chart.getConfiguration().getyAxis().getLabels()
.setFormatter("function() { return this.point.name + ' sample'; }");
I can't seem to get it to work correctly, as the chart always displays only the point.name
part and not the ' sample'
part. I did the same for the tooltip where it works:
chart.getConfiguration().getTooltip()
.setFormatter("function() { return this.point.name + ' sample'; }");
Upvotes: 0
Views: 111
Reputation: 665
After quite some time I found the answer, I had to set the label formatting function in the PlotOptionsPie
object:
PlotOptionsPie plot = new PlotOptionsPie();
plot.setInnerSize("60%"); // hollow inside -> "donut" chart
plot.getDataLabels().setFormatter("function() { return this.point.name + ' sample'; }");
chart.getConfiguration().setPlotOptions(plot);
The result:
Upvotes: 0