Search in sources :

Example 1 with PlotOptionsColumn

use of com.vaadin.flow.component.charts.model.PlotOptionsColumn in project flow-components by vaadin.

the class Polar method initDemo.

@Override
public void initDemo() {
    Chart chart = new Chart();
    Configuration conf = chart.getConfiguration();
    conf.getChart().setPolar(true);
    conf.setTitle("Polar Chart");
    Pane pane = new Pane(0, 360);
    conf.addPane(pane);
    XAxis xAxis = new XAxis();
    xAxis.setTickInterval(45);
    xAxis.setMin(0);
    xAxis.setMax(360);
    Labels labels = new Labels();
    labels.setFormatter("function() {return this.value + '°';}");
    xAxis.setLabels(labels);
    YAxis yAxis = new YAxis();
    yAxis.setMin(0);
    conf.addxAxis(xAxis);
    conf.addyAxis(yAxis);
    PlotOptionsSeries series = new PlotOptionsSeries();
    PlotOptionsColumn column = new PlotOptionsColumn();
    series.setPointStart(0);
    series.setPointInterval(45);
    column.setPointPadding(0);
    column.setGroupPadding(0);
    conf.setPlotOptions(series, column);
    ListSeries col = new ListSeries(8, 7, 6, 5, 4, 3, 2, 1);
    ListSeries line = new ListSeries(1, 2, 3, 4, 5, 6, 7, 8);
    ListSeries area = new ListSeries(1, 8, 2, 7, 3, 6, 4, 5);
    col.setPlotOptions(new PlotOptionsColumn());
    col.setName(ChartType.COLUMN.toString());
    line.setPlotOptions(new PlotOptionsLine());
    line.setName(ChartType.LINE.toString());
    area.setPlotOptions(new PlotOptionsArea());
    area.setName(ChartType.AREA.toString());
    conf.setSeries(col, line, area);
    add(chart);
}
Also used : Configuration(com.vaadin.flow.component.charts.model.Configuration) PlotOptionsColumn(com.vaadin.flow.component.charts.model.PlotOptionsColumn) ListSeries(com.vaadin.flow.component.charts.model.ListSeries) PlotOptionsLine(com.vaadin.flow.component.charts.model.PlotOptionsLine) PlotOptionsArea(com.vaadin.flow.component.charts.model.PlotOptionsArea) Labels(com.vaadin.flow.component.charts.model.Labels) Pane(com.vaadin.flow.component.charts.model.Pane) Chart(com.vaadin.flow.component.charts.Chart) XAxis(com.vaadin.flow.component.charts.model.XAxis) PlotOptionsSeries(com.vaadin.flow.component.charts.model.PlotOptionsSeries) YAxis(com.vaadin.flow.component.charts.model.YAxis)

Example 2 with PlotOptionsColumn

use of com.vaadin.flow.component.charts.model.PlotOptionsColumn in project flow-components by vaadin.

the class DynamicChangingChart method getPolarConfiguration.

public Configuration getPolarConfiguration() {
    Configuration configuration = new Configuration();
    configuration.getChart().setPolar(true);
    configuration.setTitle("Polar Chart");
    Pane pane = new Pane(0, 360);
    configuration.addPane(pane);
    XAxis xAxis = new XAxis();
    xAxis.setTickInterval(45);
    xAxis.setMin(0);
    xAxis.setMax(360);
    Labels labels = new Labels();
    labels.setFormatter("function() {return this.value + '°';}");
    xAxis.setLabels(labels);
    YAxis yAxis = new YAxis();
    yAxis.setMin(0);
    configuration.addxAxis(xAxis);
    configuration.addyAxis(yAxis);
    PlotOptionsSeries series = new PlotOptionsSeries();
    PlotOptionsColumn column = new PlotOptionsColumn();
    series.setPointStart(0);
    series.setPointInterval(45);
    column.setPointPadding(0);
    column.setGroupPadding(0);
    configuration.setPlotOptions(series, column);
    ListSeries col = new ListSeries(8, 7, 6, 5, 4, 3, 2, 1);
    ListSeries line = new ListSeries(1, 2, 3, 4, 5, 6, 7, 8);
    ListSeries area = new ListSeries(1, 8, 2, 7, 3, 6, 4, 5);
    col.setPlotOptions(new PlotOptionsColumn());
    col.setName(ChartType.COLUMN.toString());
    line.setPlotOptions(new PlotOptionsLine());
    line.setName(ChartType.LINE.toString());
    area.setPlotOptions(new PlotOptionsArea());
    area.setName(ChartType.AREA.toString());
    configuration.setSeries(col, line, area);
    return configuration;
}
Also used : Configuration(com.vaadin.flow.component.charts.model.Configuration) PlotOptionsColumn(com.vaadin.flow.component.charts.model.PlotOptionsColumn) ListSeries(com.vaadin.flow.component.charts.model.ListSeries) PlotOptionsLine(com.vaadin.flow.component.charts.model.PlotOptionsLine) PlotOptionsArea(com.vaadin.flow.component.charts.model.PlotOptionsArea) Labels(com.vaadin.flow.component.charts.model.Labels) Pane(com.vaadin.flow.component.charts.model.Pane) XAxis(com.vaadin.flow.component.charts.model.XAxis) PlotOptionsSeries(com.vaadin.flow.component.charts.model.PlotOptionsSeries) YAxis(com.vaadin.flow.component.charts.model.YAxis)

Example 3 with PlotOptionsColumn

use of com.vaadin.flow.component.charts.model.PlotOptionsColumn in project flow-components by vaadin.

the class ErrorBar method initDemo.

@Override
public void initDemo() {
    Chart chart = new Chart();
    Configuration configuration = chart.getConfiguration();
    configuration.setTitle("Monthly Rainfall");
    XAxis x = new XAxis();
    x.setCategories("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
    configuration.addxAxis(x);
    YAxis y = new YAxis();
    Labels yLabels = new Labels();
    yLabels.setFormat("{value} mm");
    y.setLabels(yLabels);
    y.setTitle("Rainfall");
    configuration.addyAxis(y);
    Tooltip tooltip = new Tooltip();
    tooltip.setShared(true);
    configuration.setTooltip(tooltip);
    Series rainfall = new ListSeries("Rainfall", 49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4);
    PlotOptionsColumn rainfallOptions = new PlotOptionsColumn();
    SeriesTooltip rainfallTooltip = new SeriesTooltip();
    rainfallTooltip.setPointFormat("<span style=\"font-weight: bold; color: {series.color}\">" + "{series.name}</span>: <b>{point.y:.1f} mm</b> ");
    rainfallOptions.setTooltip(rainfallTooltip);
    rainfall.setPlotOptions(rainfallOptions);
    configuration.addSeries(rainfall);
    Series error = new RangeSeries("Rainfall error", new Number[] { 48, 51 }, new Number[] { 68, 73 }, new Number[] { 92, 110 }, new Number[] { 128, 136 }, new Number[] { 140, 150 }, new Number[] { 171, 179 }, new Number[] { 135, 143 }, new Number[] { 142, 149 }, new Number[] { 204, 220 }, new Number[] { 189, 199 }, new Number[] { 95, 110 }, new Number[] { 52, 56 });
    PlotOptionsErrorbar errorOptions = new PlotOptionsErrorbar();
    SeriesTooltip errorTooltip = new SeriesTooltip();
    errorTooltip.setPointFormat("(error range: {point.low}-{point.high} mm)<br/>");
    errorOptions.setTooltip(errorTooltip);
    error.setPlotOptions(errorOptions);
    configuration.addSeries(error);
    add(chart);
}
Also used : RangeSeries(com.vaadin.flow.component.charts.model.RangeSeries) ListSeries(com.vaadin.flow.component.charts.model.ListSeries) Series(com.vaadin.flow.component.charts.model.Series) PlotOptionsErrorbar(com.vaadin.flow.component.charts.model.PlotOptionsErrorbar) Configuration(com.vaadin.flow.component.charts.model.Configuration) ListSeries(com.vaadin.flow.component.charts.model.ListSeries) PlotOptionsColumn(com.vaadin.flow.component.charts.model.PlotOptionsColumn) RangeSeries(com.vaadin.flow.component.charts.model.RangeSeries) Tooltip(com.vaadin.flow.component.charts.model.Tooltip) SeriesTooltip(com.vaadin.flow.component.charts.model.SeriesTooltip) Labels(com.vaadin.flow.component.charts.model.Labels) Chart(com.vaadin.flow.component.charts.Chart) XAxis(com.vaadin.flow.component.charts.model.XAxis) YAxis(com.vaadin.flow.component.charts.model.YAxis) SeriesTooltip(com.vaadin.flow.component.charts.model.SeriesTooltip)

Example 4 with PlotOptionsColumn

use of com.vaadin.flow.component.charts.model.PlotOptionsColumn in project flow-components by vaadin.

the class ColumnWithLazyMultiLevelDrilldown method initDemo.

@Override
public void initDemo() {
    log = new Div();
    log.setId("log");
    Div layout = new Div();
    final Chart chart = new Chart(ChartType.COLUMN);
    chart.setId("chart");
    final Configuration conf = chart.getConfiguration();
    conf.setTitle("Global happiness index");
    conf.setSubTitle("Source: www.happyplanetindex.org");
    conf.getLegend().setEnabled(false);
    XAxis x = new XAxis();
    x.setType(AxisType.CATEGORY);
    conf.addxAxis(x);
    YAxis y = new YAxis();
    y.setTitle("Total");
    conf.addyAxis(y);
    PlotOptionsColumn column = new PlotOptionsColumn();
    column.setCursor(Cursor.POINTER);
    column.setDataLabels(new DataLabels(true));
    conf.setPlotOptions(column);
    DataSeries series = new DataSeries();
    series.setName("Regions");
    PlotOptionsColumn plotOptionsColumn = new PlotOptionsColumn();
    plotOptionsColumn.setColorByPoint(true);
    series.setPlotOptions(plotOptionsColumn);
    DataSeriesItem item = new DataSeriesItem("Latin America and Caribbean", 60);
    item.setId("Latin America and Caribbean");
    series.addItemWithDrilldown(item);
    item = new DataSeriesItem("Europe", 50);
    item.setId("Europe");
    series.addItemWithDrilldown(item);
    conf.addSeries(series);
    drillSeries = new HashMap<String, DataSeries>();
    DataSeries drill = new DataSeries("Latin America and Caribbean Countries");
    drill.setId("Latin America and Caribbean Countries");
    item = new DataSeriesItem("Costa Rica", 64);
    item.setId("Costa Rica");
    drill.addItemWithDrilldown(item);
    item = new DataSeriesItem("Colombia", 59.8);
    item.setId("Colombia");
    drill.addItemWithDrilldown(item);
    item = new DataSeriesItem("Belize", 59.3);
    item.setId("Belize");
    drill.addItemWithDrilldown(item);
    drillSeries.put("Latin America and Caribbean", drill);
    drill = new DataSeries("Europe");
    drill.setId("European Countries");
    item = new DataSeriesItem("Norway", 51.4);
    item.setId("Norway");
    drill.addItemWithDrilldown(item);
    item = new DataSeriesItem("Switzerland", 50.3);
    item.setId("Switzerland");
    drill.addItemWithDrilldown(item);
    item = new DataSeriesItem("Portugal", 38.7);
    item.setId("Portugal");
    drill.addItemWithDrilldown(item);
    drillSeries.put("Europe", drill);
    drill = new DataSeries("Details Costa Rica");
    drill.setId("Details Costa Rica");
    final String[] categories = new String[] { "Life Expectancy", "Well-being (0-10)", "Footprint (gha/capita)" };
    Number[] ys = new Number[] { 79.3, 7.3, 2.5 };
    drill.setData(categories, ys);
    drillSeries.put("Costa Rica", drill);
    drill = new DataSeries("Details Colombia");
    drill.setId("Details Colombia");
    ys = new Number[] { 73.7, 6.4, 1.8 };
    drill.setData(categories, ys);
    drillSeries.put("Colombia", drill);
    drill = new DataSeries("Details Belize");
    drill.setId("Details Belize");
    ys = new Number[] { 76.1, 6.5, 2.1 };
    drill.setData(categories, ys);
    drillSeries.put("Belize", drill);
    drill = new DataSeries("Details Norway");
    drill.setId("Details Norway");
    ys = new Number[] { 81.1, 7.6, 4.8 };
    drill.setData(categories, ys);
    drillSeries.put("Norway", drill);
    drill = new DataSeries("Details Switzerland");
    drill.setId("Details Switzerland");
    ys = new Number[] { 82.3, 7.5, 5.0 };
    drill.setData(categories, ys);
    drillSeries.put("Switzerland", drill);
    drill = new DataSeries("Details Portugal");
    drill.setId("Details Portugal");
    ys = new Number[] { 79.5, 4.9, 4.1 };
    drill.setData(categories, ys);
    drillSeries.put("Portugal", drill);
    chart.setDrilldownCallback((DrilldownCallback) event -> {
        log("DrilldownEvent: " + event.getItem().getId());
        return getPointDrilldown(event.getItem());
    });
    chart.addChartDrillupListener(event -> log("ChartDrillupEvent"));
    layout.add(chart, log);
    add(layout);
}
Also used : Text(com.vaadin.flow.component.Text) PlotOptionsColumn(com.vaadin.flow.component.charts.model.PlotOptionsColumn) Chart(com.vaadin.flow.component.charts.Chart) XAxis(com.vaadin.flow.component.charts.model.XAxis) Div(com.vaadin.flow.component.html.Div) HashMap(java.util.HashMap) DrilldownCallback(com.vaadin.flow.component.charts.model.DrilldownCallback) AbstractChartExample(com.vaadin.flow.component.charts.examples.AbstractChartExample) Cursor(com.vaadin.flow.component.charts.model.Cursor) Configuration(com.vaadin.flow.component.charts.model.Configuration) DataLabels(com.vaadin.flow.component.charts.model.DataLabels) DataSeriesItem(com.vaadin.flow.component.charts.model.DataSeriesItem) ChartType(com.vaadin.flow.component.charts.model.ChartType) Map(java.util.Map) DataSeries(com.vaadin.flow.component.charts.model.DataSeries) Series(com.vaadin.flow.component.charts.model.Series) YAxis(com.vaadin.flow.component.charts.model.YAxis) AxisType(com.vaadin.flow.component.charts.model.AxisType) DataLabels(com.vaadin.flow.component.charts.model.DataLabels) Configuration(com.vaadin.flow.component.charts.model.Configuration) XAxis(com.vaadin.flow.component.charts.model.XAxis) Div(com.vaadin.flow.component.html.Div) PlotOptionsColumn(com.vaadin.flow.component.charts.model.PlotOptionsColumn) DataSeries(com.vaadin.flow.component.charts.model.DataSeries) Chart(com.vaadin.flow.component.charts.Chart) DataSeriesItem(com.vaadin.flow.component.charts.model.DataSeriesItem) YAxis(com.vaadin.flow.component.charts.model.YAxis)

Example 5 with PlotOptionsColumn

use of com.vaadin.flow.component.charts.model.PlotOptionsColumn in project flow-components by vaadin.

the class ColumnWithMultiLevelDrilldown method initDemo.

@Override
public void initDemo() {
    final Chart chart = new Chart(ChartType.COLUMN);
    chart.setId("chart");
    final Configuration conf = chart.getConfiguration();
    conf.setTitle("Global happiness index");
    conf.setSubTitle("Source: www.happyplanetindex.org");
    conf.getLegend().setEnabled(false);
    XAxis x = new XAxis();
    x.setType(AxisType.CATEGORY);
    conf.addxAxis(x);
    YAxis y = new YAxis();
    y.setTitle("Total percent market share");
    conf.addyAxis(y);
    PlotOptionsColumn column = new PlotOptionsColumn();
    column.setCursor(Cursor.POINTER);
    column.setDataLabels(new DataLabels(true));
    conf.setPlotOptions(column);
    DataSeries regionsSeries = new DataSeries();
    regionsSeries.setName("Regions");
    PlotOptionsColumn plotOptionsColumn = new PlotOptionsColumn();
    plotOptionsColumn.setColorByPoint(true);
    regionsSeries.setPlotOptions(plotOptionsColumn);
    DataSeriesItem regionItem = new DataSeriesItem("Latin America and Caribbean", 60);
    DataSeries countriesSeries = new DataSeries("Countries");
    countriesSeries.setId("Latin America and Caribbean Countries");
    DataSeriesItem countryItem = new DataSeriesItem("Costa Rica", 64);
    DataSeries detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Costa Rica");
    String[] categories = new String[] { "Life Expectancy", "Well-being (0-10)", "Footprint (gha/capita)" };
    Number[] ys = new Number[] { 79.3, 7.3, 2.5 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("Colombia", 59.8);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Colombia");
    ys = new Number[] { 73.7, 6.4, 1.8 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("Belize", 59.3);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Belize");
    ys = new Number[] { 76.1, 6.5, 2.1 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("El Salvador", 58.9);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details El Salvador");
    ys = new Number[] { 72.2, 6.7, 2.0 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    regionsSeries.addItemWithDrilldown(regionItem, countriesSeries);
    regionItem = new DataSeriesItem("Western Nations", 50);
    countriesSeries = new DataSeries("Countries");
    countriesSeries.setId("Western Nations Countries");
    countryItem = new DataSeriesItem("New Zealand", 51.6);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details New Zealand");
    ys = new Number[] { 80.7, 7.2, 4.3 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("Norway", 51.4);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Norway");
    ys = new Number[] { 81.1, 7.6, 4.8 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("Switzerland", 50.3);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Switzerland");
    ys = new Number[] { 82.3, 7.5, 5.0 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("United Kingdom", 47.9);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details United Kingdom");
    ys = new Number[] { 80.2, 7.0, 4.7 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    regionsSeries.addItemWithDrilldown(regionItem, countriesSeries);
    regionItem = new DataSeriesItem("Middle East and North Africa", 53);
    countriesSeries = new DataSeries("Countries");
    countriesSeries.setId("Middle East and North Africa Countries");
    countryItem = new DataSeriesItem("Israel", 55.2);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Israel");
    ys = new Number[] { 81.6, 7.4, 4.0 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("Algeria", 52.2);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Algeria");
    ys = new Number[] { 73.1, 5.2, 1.6 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("Jordan", 51.7);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Jordan");
    ys = new Number[] { 73.4, 5.7, 2.1 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("Palestine", 51.2);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Palestine");
    ys = new Number[] { 72.8, 4.8, 1.4 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    regionsSeries.addItemWithDrilldown(regionItem, countriesSeries);
    regionItem = new DataSeriesItem("Sub-Saharan Africa", 42);
    countriesSeries = new DataSeries("Countries");
    countriesSeries.setId("Sub-Saharan Africa Countries");
    countryItem = new DataSeriesItem("Nigeria", 51.6);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Nigeria");
    ys = new Number[] { 66.7, 4.6, 1.2 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("Malawi", 42.5);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Malawi");
    ys = new Number[] { 54.2, 5.1, 0.8 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("Ghana", 40.3);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Ghana");
    ys = new Number[] { 64.2, 4.6, 1.7 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("Ethiopia", 39.2);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Ethiopia");
    ys = new Number[] { 59.3, 4.4, 1.1 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    regionsSeries.addItemWithDrilldown(regionItem, countriesSeries);
    regionItem = new DataSeriesItem("South Asia", 53);
    countriesSeries = new DataSeries("Countries");
    countriesSeries.setId("South Asia Countries");
    countryItem = new DataSeriesItem("Bangladesh", 56.3);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Bangladesh");
    ys = new Number[] { 68.9, 5.0, 0.7 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("Pakistan", 54.1);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Pakistan");
    ys = new Number[] { 65.4, 5.3, 0.8 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("India", 50.9);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details India");
    ys = new Number[] { 65.4, 5.0, 0.9 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("Sri Lanka", 51.2);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Sri Lanka");
    ys = new Number[] { 74.9, 4.2, 1.2 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    regionsSeries.addItemWithDrilldown(regionItem, countriesSeries);
    regionItem = new DataSeriesItem("East Asia", 55);
    countriesSeries = new DataSeries("Countries");
    countriesSeries.setId("East Asia Countries");
    countryItem = new DataSeriesItem("Vietnam", 60.4);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Vietnam");
    ys = new Number[] { 75.2, 5.8, 1.4 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("Indonesia", 55.5);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Indonesia");
    ys = new Number[] { 69.4, 5.5, 1.1 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("Thailand", 53.5);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Thailand");
    ys = new Number[] { 74.1, 6.2, 2.4 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    countryItem = new DataSeriesItem("Philippines", 52.4);
    detailsSeries = new DataSeries("Details");
    detailsSeries.setId("Details Philippines");
    ys = new Number[] { 68.7, 4.9, 1.0 };
    detailsSeries.setData(categories, ys);
    countriesSeries.addItemWithDrilldown(countryItem, detailsSeries);
    regionsSeries.addItemWithDrilldown(regionItem, countriesSeries);
    conf.addSeries(regionsSeries);
    add(chart);
}
Also used : DataLabels(com.vaadin.flow.component.charts.model.DataLabels) Configuration(com.vaadin.flow.component.charts.model.Configuration) PlotOptionsColumn(com.vaadin.flow.component.charts.model.PlotOptionsColumn) DataSeries(com.vaadin.flow.component.charts.model.DataSeries) Chart(com.vaadin.flow.component.charts.Chart) XAxis(com.vaadin.flow.component.charts.model.XAxis) DataSeriesItem(com.vaadin.flow.component.charts.model.DataSeriesItem) YAxis(com.vaadin.flow.component.charts.model.YAxis)

Aggregations

PlotOptionsColumn (com.vaadin.flow.component.charts.model.PlotOptionsColumn)14 Chart (com.vaadin.flow.component.charts.Chart)13 XAxis (com.vaadin.flow.component.charts.model.XAxis)13 YAxis (com.vaadin.flow.component.charts.model.YAxis)11 Configuration (com.vaadin.flow.component.charts.model.Configuration)10 DataSeries (com.vaadin.flow.component.charts.model.DataSeries)8 Tooltip (com.vaadin.flow.component.charts.model.Tooltip)7 DataLabels (com.vaadin.flow.component.charts.model.DataLabels)6 DataSeriesItem (com.vaadin.flow.component.charts.model.DataSeriesItem)5 ListSeries (com.vaadin.flow.component.charts.model.ListSeries)5 Labels (com.vaadin.flow.component.charts.model.Labels)4 Div (com.vaadin.flow.component.html.Div)3 ChartType (com.vaadin.flow.component.charts.model.ChartType)2 Legend (com.vaadin.flow.component.charts.model.Legend)2 Pane (com.vaadin.flow.component.charts.model.Pane)2 PlotOptionsArea (com.vaadin.flow.component.charts.model.PlotOptionsArea)2 PlotOptionsLine (com.vaadin.flow.component.charts.model.PlotOptionsLine)2 PlotOptionsSeries (com.vaadin.flow.component.charts.model.PlotOptionsSeries)2 PlotOptionsSpline (com.vaadin.flow.component.charts.model.PlotOptionsSpline)2 Series (com.vaadin.flow.component.charts.model.Series)2