Class DefaultDataConverter
- All Implemented Interfaces:
DataConverter,Serializable
DataConverter that handles common data
conversion patterns for various chart types.
This converter uses column-name-based pattern matching to determine the
appropriate series type and data structure. All expected column names are
defined in ColumnNames and prefixed with "_"
to avoid collisions with real data columns. Patterns are checked in priority
order from most-specific to least-specific:
- OHLC/Candlestick (
_open,_high,_low,_close) - BoxPlot (
_low,_q1,_median,_q3,_high) - Organization (
_id,_name,_parent,_title; optionally_description,_image,_color) - Gantt (
_name,_start,_end; optionally_id,_parent,_dependency,_completed,_color) - Treemap (
_id,_parent,_value) - Sankey (
_from,_to,_weight) - Heatmap (
_x,_y,_value) - XRange (
_x,_x2,_y) - Timeline (
_name,_label,_description) - Bubble (
_x,_y,_z) - Flags (
_title, optionally_text; requires absence of_parentto avoid matching Organization/Treemap data) - Range (
_low,_high) - Bullet (
_y,_target) - Waterfall (
_y,_waterfall_type; type values are"sum"and"intermediate", case-insensitive;nullor absent for regular data points) - Fallback: first non-numeric column as category, first numeric column as value
Additionally, any pattern that produces a DataSeriesItem (or
subclass) supports an optional _color column. If present, the value
is used to set the item's color via SolidColor(String).
Column name matching is case-insensitive. Column names are determined from
the first row; subsequent rows with missing keys will yield null for
those columns.
If the data contains a _series column, rows are automatically grouped
by that column's value and each group is converted into a separate named
series. The _series column is removed before pattern matching so it
does not interfere with chart type detection.
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
DefaultDataConverter
public DefaultDataConverter()
-
-
Method Details
-
convertToSeries
Description copied from interface:DataConverterConverts tabular data into one or more chart series.Each element in the input list represents a single row, with column names as keys and column values as values.
- Specified by:
convertToSeriesin interfaceDataConverter- Parameters:
data- the tabular data to convert, notnull- Returns:
- a list of series ready for use in a chart, never
nulland never empty
-