Search in sources :

Example 1 with DataSeriesItemXrange

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

the class Xrange method initDemo.

@Override
public void initDemo() {
    Chart chart = new Chart(ChartType.XRANGE);
    Configuration conf = chart.getConfiguration();
    conf.setTitle("X-range");
    conf.getxAxis().setType(AxisType.DATETIME);
    conf.getyAxis().setTitle("");
    conf.getyAxis().setCategories("Prototyping", "Development", "Testing");
    conf.getyAxis().setReversed(true);
    DataSeries series = new DataSeries();
    series.setName("Project 1");
    series.add(new DataSeriesItemXrange(getInstant(2014, 11, 21), getInstant(2014, 12, 2), 0, 0.25));
    series.add(new DataSeriesItemXrange(getInstant(2014, 12, 2), getInstant(2014, 12, 5), 1));
    series.add(new DataSeriesItemXrange(getInstant(2014, 12, 8), getInstant(2014, 12, 9), 2));
    series.add(new DataSeriesItemXrange(getInstant(2014, 12, 9), getInstant(2014, 12, 19), 1));
    series.add(new DataSeriesItemXrange(getInstant(2014, 12, 10), getInstant(2014, 12, 23), 2));
    PlotOptionsXrange options = new PlotOptionsXrange();
    options.setBorderColor(SolidColor.GRAY);
    options.setPointWidth(20);
    options.getDataLabels().setEnabled(true);
    series.setPlotOptions(options);
    conf.addSeries(series);
    add(chart);
}
Also used : PlotOptionsXrange(com.vaadin.flow.component.charts.model.PlotOptionsXrange) Configuration(com.vaadin.flow.component.charts.model.Configuration) DataSeries(com.vaadin.flow.component.charts.model.DataSeries) DataSeriesItemXrange(com.vaadin.flow.component.charts.model.DataSeriesItemXrange) Chart(com.vaadin.flow.component.charts.Chart)

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 DataSeriesItemXrange (com.vaadin.flow.component.charts.model.DataSeriesItemXrange)1 PlotOptionsXrange (com.vaadin.flow.component.charts.model.PlotOptionsXrange)1