Search in sources :

Example 1 with PlotOptionsPyramid

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

the class Pyramid method initDemo.

@Override
public void initDemo() {
    Chart chart = new Chart(ChartType.PYRAMID);
    Configuration configuration = chart.getConfiguration();
    configuration.setTitle("Sales pyramid");
    configuration.getLegend().setEnabled(false);
    PlotOptionsPyramid plotOptionsSeries = new PlotOptionsPyramid();
    DataLabelsFunnel dataLabels = plotOptionsSeries.getDataLabels();
    dataLabels.setEnabled(true);
    dataLabels.setSoftConnector(true);
    dataLabels.setFormat("<b>{point.name}</b> ({point.y:,.0f})");
    plotOptionsSeries.setCenter("40%", "50%");
    plotOptionsSeries.setWidth("60%");
    configuration.setPlotOptions(plotOptionsSeries);
    DataSeries series = new DataSeries("Unique users");
    series.add(new DataSeriesItem("Website visits", 15654));
    series.add(new DataSeriesItem("Downloads", 4064));
    series.add(new DataSeriesItem("Requested price list", 1987));
    series.add(new DataSeriesItem("Invoice sent", 976));
    series.add(new DataSeriesItem("Finalized", 846));
    configuration.addSeries(series);
    add(chart);
}
Also used : DataLabelsFunnel(com.vaadin.flow.component.charts.model.DataLabelsFunnel) Configuration(com.vaadin.flow.component.charts.model.Configuration) PlotOptionsPyramid(com.vaadin.flow.component.charts.model.PlotOptionsPyramid) DataSeries(com.vaadin.flow.component.charts.model.DataSeries) Chart(com.vaadin.flow.component.charts.Chart) DataSeriesItem(com.vaadin.flow.component.charts.model.DataSeriesItem)

Aggregations

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