For X axis, the coordinates are generated at fixed intervals starting from the value specified with the pointStart property (default is 0) at intervals specified with the pointInterval property (default is 1.0).
Setting the Data
The data in a RangeSeries is given as an array of minimum-maximum value pairs for the Y value axis. The pairs are also represented as arrays. You can pass the data using the ellipsis in the constructor or the setData():
RangeSeries series =
new RangeSeries("Temperature Ranges", new Double[]{-51.5,10.9},
new Double[]{-49.0,11.8},
...
new Double[]{-47.0,10.8}); conf.addSeries(series);
Or, as always with variable arguments, you can also pass them in an array, in the following for the setData():
series.setData(new Double[][] { new Double[]{-51.5,10.9}, new Double[]{-49.0,11.8},
...
new Double[]{-47.0,10.8}});
19.6.4. Container Data Series
The ContainerDataSeries is an adapter for binding Vaadin Container data sources to charts. The container needs to have properties that define the name, X-value, and Y-value of a data point. The default property IDs of the three properties are "name", "x", and "y", respectively. You can set the property IDs with setNamePropertyId(), setYPropertyId(), and setXPropertyId(), respectively. If the container has no x property, the data is assumed to be categorical.
In the following example, we have a BeanItemContainer with Planet items, which have a name and diameter property. We display the container data both in a Vaadin Table and a chart.
//The data BeanItemContainer<Planet> container =
new BeanItemContainer<Planet>(Planet.class); container.addBean(new Planet("Mercury", 4900)); container.addBean(new Planet("Venus", 12100)); container.addBean(new Planet("Earth", 12800));
...
//Display it in a table
Table table = new Table("Planets", container); table.setPageLength(container.size()); table.setVisibleColumns(new String[]{"name","diameter"}); layout.addComponent(table);
// Display it in a chart
Chart chart = new Chart(ChartType.COLUMN);
... Configure it ...
//Wrap the container in a data series ContainerDataSeries series =
new ContainerDataSeries(container);
//Set up the name and Y properties