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%");
}
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));
}
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;
}
Aggregations