Search in sources :

Example 1 with PlotOptionsPyramid

use of com.vaadin.addon.charts.model.PlotOptionsPyramid in project charts by vaadin.

the class Migration method methodnamedifColor.

public void methodnamedifColor() {
    PlotOptionsPyramid options = new PlotOptionsPyramid();
    options.setWidth(70, Sizeable.Unit.PERCENTAGE);
    options.setWidth("70%");
}
Also used : PlotOptionsPyramid(com.vaadin.addon.charts.model.PlotOptionsPyramid)

Example 2 with PlotOptionsPyramid

use of com.vaadin.addon.charts.model.PlotOptionsPyramid in project charts by vaadin.

the class DataSeriesItemJSONSerializationTest method toJSON_PlotOptionsPyramidIsSet_SeriesSerializedWithType.

@Test
public void toJSON_PlotOptionsPyramidIsSet_SeriesSerializedWithType() {
    DataSeries series = new DataSeries();
    series.setPlotOptions(new PlotOptionsPyramid());
    String expected = "{\"data\":[],\"type\":\"pyramid\"}";
    assertEquals(expected, toJSON(series));
}
Also used : PlotOptionsPyramid(com.vaadin.addon.charts.model.PlotOptionsPyramid) DataSeries(com.vaadin.addon.charts.model.DataSeries) Test(org.junit.Test)

Example 3 with PlotOptionsPyramid

use of com.vaadin.addon.charts.model.PlotOptionsPyramid in project charts by vaadin.

the class PyramidChartExample method getChart.

@Override
protected Component getChart() {
    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 pyramid");
    conf.getLegend().setEnabled(false);
    PlotOptionsPyramid options = new PlotOptionsPyramid();
    // With default (90%), long labels in this example may be cut
    options.setWidth(70, Unit.PERCENTAGE);
    // in pixels
    // options.setWidth(400);
    DataLabelsFunnel dataLabels = new DataLabelsFunnel();
    dataLabels.setFormat("<b>{point.name}</b> ({point.y:,.0f})");
    options.setDataLabels(dataLabels);
    dataSeries.setPlotOptions(options);
    conf.addSeries(dataSeries);
    return chart;
}
Also used : DataLabelsFunnel(com.vaadin.addon.charts.model.DataLabelsFunnel) Configuration(com.vaadin.addon.charts.model.Configuration) PlotOptionsPyramid(com.vaadin.addon.charts.model.PlotOptionsPyramid) DataSeries(com.vaadin.addon.charts.model.DataSeries) DataSeriesItem(com.vaadin.addon.charts.model.DataSeriesItem) Chart(com.vaadin.addon.charts.Chart)

Aggregations

PlotOptionsPyramid (com.vaadin.addon.charts.model.PlotOptionsPyramid)3 DataSeries (com.vaadin.addon.charts.model.DataSeries)2 Chart (com.vaadin.addon.charts.Chart)1 Configuration (com.vaadin.addon.charts.model.Configuration)1 DataLabelsFunnel (com.vaadin.addon.charts.model.DataLabelsFunnel)1 DataSeriesItem (com.vaadin.addon.charts.model.DataSeriesItem)1 Test (org.junit.Test)1