Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
book-of-vaadin.pdf
Скачиваний:
88
Добавлен:
24.03.2015
Размер:
13.43 Mб
Скачать

Vaadin Charts

Data points are associated with some visual representation parameters: marker style, selected state, legend index, and dial style (for gauges). Most of them can be configured at the level of individual data series items, the series, or in the overall plot options for the chart.The configuration options are described in Section 19.5, “Chart Configuration”. Some parameters, such as the sliced option for pie charts is only meaningful to configure at item level.

Adding and Removing Data Items

New DataSeriesItem items are added to a series with the add() method. The basic method takes just the data item, but the other method takes also two boolean parameters. If the updateChart parameter is false, the chart is not updated immediately. This is useful if you are adding many points in the same request.

The shift parameter, when true, causes removal of the first data point in the series in an optimized manner, thereby allowing an animated chart that moves to left as new points are added. This is most meaningful with data with even intervals.

You can remove data points with the remove() method in the series. Removal is generally not animated, unless a data point is added in the same change, as is caused by the shift parameter for the add().

Updating Data Items

If you update the properties of a DataSeriesItem object, you need to call update() method for the series with the item as the parameter. Changing the coordinates of a data point in this way causes animation of the change.

Range Data

Range charts expect the Y values to be specified as minimum-maximum value pairs. The DataSeriesItem provides setLow() and setHigh() methods to set the minimum and maximum values of a data point, as well as a number of constructors that accept the values.

RangeSeries series =

new RangeSeries("Temperature Extremes");

//Give low-high values in constructor series2.add(new DataSeriesItem(0, -51.5, 10.9)); series2.add(new DataSeriesItem(1, -49.0, 11.8));

//Set low-high values with setters DataSeriesItem point2 = new DataSeriesItem(); point2.setX(2);

point2.setLow(-44.3); point2.setHigh(17.5); series2.add(point2);

The RangeSeries offers a slightly simplified way of adding ranged data points, as described in Section 19.6.3, “Range Series”.

19.6.3. Range Series

The RangeSeries is a helper class that extends DataSeries to allow specifying interval data a bit easier, with a list of minimum-maximum value ranges in the Y axis. You can use the series in range charts, as described in Section 19.4.7, “Area and Column Range Charts”.

430

Range Series

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]