How to set additional data to data series

Hello, I need to add some additional data to data series. I found
a solution
but it is for highcharts. Therefore it is in javascript. I couldnt find a way to implement this on Vaadin. Can you help me please? Thanks in advance.

Hi,

you should be able to use the same in Vaadin Charts as well. Just use tooltip.setFormatter() with the same “function() {…}” as the input.

-Olli

Hi Oli thanks for quick reply.
My problem is I cannot add the additonal data to the series. If I could, I can acces them with javascript. In the accepted answer, he adds the additonal data like this

new Highcharts.Chart( { ..., series: [{ name: 'Foo', data: [ { y : 3, myData : 'firstPoint' }, { y : 7, myData : 'secondPoint' }, { y : 1, myData : 'thirdPoint' } ] } ] } ); I want to add data like this too, but I cant do it. I cant see an add method in DataSeries class that supports this operation. Am I missing something or is there an another way to do this?

Ok I solved this myself. If there is any easy way to do this please let me know. First, I created a class that extends to DataSeriesItem

[code]
public class MyDataSeriesItem extends DataSeriesItem{
String myData;
public MyDataSeriesItem(String name, double y) {

    super.setName(name);
    super.setY(y);

}
public void addAdditionalData(String data){
myData=data;
}
}
[/code]Then, I added data 1 by 1 in a for loop like this MyDataSeriesItem item = new MyDataSeriesItem(name, cost); item.addAdditionalData(""+Math.random()); dataSeries.add(item); Lastly, I get the random number in the formatter

tooltip.setFormatter("this.point.myData"); Now I can see random numbers in the tooltip.