Search in sources :

Example 1 with PlotOptionsFunnel

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

the class DynamicChangingChart method getFunnelConfiguration.

private Configuration getFunnelConfiguration() {
    DataSeries dataSeries = new DataSeries("Unique users");
    dataSeries.add(new DataSeriesItem("Website visits", 15654));
    dataSeries.add(new DataSeriesItem("Downloads", 4064));
    dataSeries.add(new DataSeriesItem("Requested price list", 1987));
    dataSeries.add(new DataSeriesItem("Invoice sent", 976));
    dataSeries.add(new DataSeriesItem("Finalized", 846));
    Configuration configuration = new Configuration();
    configuration.setTitle("Sales funnel");
    configuration.getLegend().setEnabled(false);
    PlotOptionsFunnel options = new PlotOptionsFunnel();
    options.setReversed(false);
    options.setNeckWidth("30%");
    options.setNeckHeight("30%");
    options.setWidth("70%");
    DataLabelsFunnel dataLabels = new DataLabelsFunnel();
    dataLabels.setFormat("<b>{point.name}</b> ({point.y:,.0f})");
    options.setDataLabels(dataLabels);
    dataSeries.setPlotOptions(options);
    configuration.addSeries(dataSeries);
    return configuration;
}
Also used : DataLabelsFunnel(com.vaadin.flow.component.charts.model.DataLabelsFunnel) Configuration(com.vaadin.flow.component.charts.model.Configuration) PlotOptionsFunnel(com.vaadin.flow.component.charts.model.PlotOptionsFunnel) DataSeries(com.vaadin.flow.component.charts.model.DataSeries) DataSeriesItem(com.vaadin.flow.component.charts.model.DataSeriesItem)

Example 2 with PlotOptionsFunnel

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

the class FunnelChart method initDemo.

@Override
public void initDemo() {
    DataSeries dataSeries = new DataSeries("Unique users");
    dataSeries.add(new DataSeriesItem("Website visits", 15654));
    dataSeries.add(new DataSeriesItem("Downloads", 4064));
    dataSeries.add(new DataSeriesItem("Requested price list", 1987));
    dataSeries.add(new DataSeriesItem("Invoice sent", 976));
    dataSeries.add(new DataSeriesItem("Finalized", 846));
    Chart chart = new Chart();
    Configuration conf = chart.getConfiguration();
    conf.setTitle("Sales funnel");
    conf.getLegend().setEnabled(false);
    PlotOptionsFunnel options = new PlotOptionsFunnel();
    options.setReversed(false);
    options.setNeckWidth("30%");
    options.setNeckHeight("30%");
    options.setWidth("70%");
    DataLabelsFunnel dataLabels = new DataLabelsFunnel();
    dataLabels.setFormat("<b>{point.name}</b> ({point.y:,.0f})");
    options.setDataLabels(dataLabels);
    dataSeries.setPlotOptions(options);
    conf.addSeries(dataSeries);
    add(chart);
}
Also used : DataLabelsFunnel(com.vaadin.flow.component.charts.model.DataLabelsFunnel) Configuration(com.vaadin.flow.component.charts.model.Configuration) PlotOptionsFunnel(com.vaadin.flow.component.charts.model.PlotOptionsFunnel) DataSeries(com.vaadin.flow.component.charts.model.DataSeries) DataSeriesItem(com.vaadin.flow.component.charts.model.DataSeriesItem) Chart(com.vaadin.flow.component.charts.Chart)

Aggregations

Configuration (com.vaadin.flow.component.charts.model.Configuration)2 DataLabelsFunnel (com.vaadin.flow.component.charts.model.DataLabelsFunnel)2 DataSeries (com.vaadin.flow.component.charts.model.DataSeries)2 DataSeriesItem (com.vaadin.flow.component.charts.model.DataSeriesItem)2 PlotOptionsFunnel (com.vaadin.flow.component.charts.model.PlotOptionsFunnel)2 Chart (com.vaadin.flow.component.charts.Chart)1