Search in sources :

Example 1 with DataLabelsFunnel

use of com.vaadin.flow.component.charts.model.DataLabelsFunnel 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)

Example 2 with DataLabelsFunnel

use of com.vaadin.flow.component.charts.model.DataLabelsFunnel 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 3 with DataLabelsFunnel

use of com.vaadin.flow.component.charts.model.DataLabelsFunnel 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)3 DataLabelsFunnel (com.vaadin.flow.component.charts.model.DataLabelsFunnel)3 DataSeries (com.vaadin.flow.component.charts.model.DataSeries)3 DataSeriesItem (com.vaadin.flow.component.charts.model.DataSeriesItem)3 Chart (com.vaadin.flow.component.charts.Chart)2 PlotOptionsFunnel (com.vaadin.flow.component.charts.model.PlotOptionsFunnel)2 PlotOptionsPyramid (com.vaadin.flow.component.charts.model.PlotOptionsPyramid)1