Search in sources :

Example 1 with FlagItem

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

the class Flags method initDemo.

@Override
public void initDemo() {
    Chart chart = new Chart(ChartType.AREASPLINE);
    Configuration configuration = chart.getConfiguration();
    configuration.setTitle("Average fruit consumption during one week");
    XAxis xAxis = new XAxis();
    xAxis.setCategories("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
    configuration.addxAxis(xAxis);
    YAxis yAxis = new YAxis();
    yAxis.setTitle("Fruit units");
    configuration.addyAxis(yAxis);
    Tooltip tooltip = new Tooltip();
    tooltip.setShared(true);
    tooltip.setValueSuffix(" units");
    configuration.setTooltip(tooltip);
    configuration.addSeries(new ListSeries("John", 3, 4, 3, 5, 4, 10, 12));
    ListSeries janeSeries = new ListSeries("Jane", 1, 3, 4, 3, 3, 5, 4);
    janeSeries.setId("jane");
    configuration.addSeries(janeSeries);
    DataSeries onSeriesFlags = new DataSeries("On series");
    PlotOptionsFlags onSeriesFlagsOptions = new PlotOptionsFlags();
    onSeriesFlagsOptions.setOnSeries("jane");
    onSeriesFlagsOptions.setShape(FlagShape.SQUAREPIN);
    onSeriesFlags.setPlotOptions(onSeriesFlagsOptions);
    onSeriesFlags.add(new FlagItem(2, "On series"));
    onSeriesFlags.add(new FlagItem(5, "On series"));
    configuration.addSeries(onSeriesFlags);
    DataSeries onAxisFlags = new DataSeries("On axis");
    onAxisFlags.setPlotOptions(new PlotOptionsFlags());
    onAxisFlags.add(new FlagItem(3, "On axis"));
    configuration.addSeries(onAxisFlags);
    add(chart);
}
Also used : Configuration(com.vaadin.flow.component.charts.model.Configuration) ListSeries(com.vaadin.flow.component.charts.model.ListSeries) Tooltip(com.vaadin.flow.component.charts.model.Tooltip) PlotOptionsFlags(com.vaadin.flow.component.charts.model.PlotOptionsFlags) FlagItem(com.vaadin.flow.component.charts.model.FlagItem) DataSeries(com.vaadin.flow.component.charts.model.DataSeries) Chart(com.vaadin.flow.component.charts.Chart) XAxis(com.vaadin.flow.component.charts.model.XAxis) YAxis(com.vaadin.flow.component.charts.model.YAxis)

Aggregations

Chart (com.vaadin.flow.component.charts.Chart)1 Configuration (com.vaadin.flow.component.charts.model.Configuration)1 DataSeries (com.vaadin.flow.component.charts.model.DataSeries)1 FlagItem (com.vaadin.flow.component.charts.model.FlagItem)1 ListSeries (com.vaadin.flow.component.charts.model.ListSeries)1 PlotOptionsFlags (com.vaadin.flow.component.charts.model.PlotOptionsFlags)1 Tooltip (com.vaadin.flow.component.charts.model.Tooltip)1 XAxis (com.vaadin.flow.component.charts.model.XAxis)1 YAxis (com.vaadin.flow.component.charts.model.YAxis)1