use of com.vaadin.addon.charts.model.PlotOptionsPie in project charts by vaadin.
the class ColumnLineAndPie method getChart.
@Override
protected Component getChart() {
Chart chart = new Chart();
Configuration conf = chart.getConfiguration();
conf.setTitle("Combined Chart");
conf.setExporting(true);
conf.getExporting().setWidth(800);
XAxis x = new XAxis();
x.setCategories(new String[] { "Apples", "Oranges", "Pears", "Bananas", "Plums" });
conf.addxAxis(x);
Style labelStyle = new Style();
labelStyle.setTop("8px");
labelStyle.setLeft("40px");
conf.setLabels(new HTMLLabels(labelStyle, new HTMLLabelItem("Total fruit consumption")));
DataSeries series = new DataSeries();
PlotOptionsColumn plotOptions = new PlotOptionsColumn();
series.setPlotOptions(plotOptions);
series.setName("Jane");
series.setData(3, 2, 1, 3, 4);
conf.addSeries(series);
series = new DataSeries();
plotOptions = new PlotOptionsColumn();
series.setPlotOptions(plotOptions);
series.setName("John");
series.setData(2, 3, 5, 7, 6);
conf.addSeries(series);
series = new DataSeries();
plotOptions = new PlotOptionsColumn();
series.setPlotOptions(plotOptions);
series.setName("Joe");
series.setData(4, 3, 3, 9, 0);
conf.addSeries(series);
series = new DataSeries();
PlotOptionsSpline splinePlotOptions = new PlotOptionsSpline();
Marker marker = new Marker();
marker.setLineWidth(2);
marker.setLineColor(new SolidColor("black"));
marker.setFillColor(new SolidColor("white"));
splinePlotOptions.setMarker(marker);
splinePlotOptions.setColor(new SolidColor("black"));
series.setPlotOptions(splinePlotOptions);
series.setName("Average");
series.setData(3, 2.67, 3, 6.33, 3.33);
conf.addSeries(series);
series = new DataSeries();
series.setPlotOptions(new PlotOptionsPie());
series.setName("Total consumption");
DataSeriesItem item = new DataSeriesItem("Jane", 13);
series.add(item);
item = new DataSeriesItem("John", 23);
series.add(item);
item = new DataSeriesItem("Joe", 19);
series.add(item);
PlotOptionsPie plotOptionsPie = new PlotOptionsPie();
plotOptionsPie.setSize("100px");
plotOptionsPie.setCenter("100px", "80px");
plotOptionsPie.setShowInLegend(false);
plotOptionsPie.setShowInLegend(false);
series.setPlotOptions(plotOptionsPie);
conf.addSeries(series);
chart.drawChart(conf);
return chart;
}
use of com.vaadin.addon.charts.model.PlotOptionsPie in project charts by vaadin.
the class ChartWithExternalContainer method createContainerView1.
private ContainerDataSeries createContainerView1(Container vaadinContainer) {
ContainerDataSeries container = new ContainerDataSeries(vaadinContainer);
container.setName("Order item quantities");
container.setPlotOptions(new PlotOptionsPie());
container.setYPropertyId(ExampleUtil.ORDER_QUANTITY_PROPERTY_ID);
container.setNamePropertyId(ExampleUtil.ORDER_DESCRIPTION_PROPERTY_ID);
return container;
}
use of com.vaadin.addon.charts.model.PlotOptionsPie in project charts by vaadin.
the class ChartWithExternalDataProvider method createChart.
public static Chart createChart(Series container, ChartType type, String text) {
final Chart chart = new Chart();
final Configuration configuration = chart.getConfiguration();
configuration.getChart().setType(type);
configuration.getTitle().setText(text);
configuration.getLegend().setEnabled(false);
PlotOptionsPie plotOptions = new PlotOptionsPie();
configuration.setPlotOptions(plotOptions);
configuration.setSeries(container);
chart.drawChart(configuration);
return chart;
}
use of com.vaadin.addon.charts.model.PlotOptionsPie in project charts by vaadin.
the class ChartTypes method chartTypesPieDonutSnippet2.
public void chartTypesPieDonutSnippet2() {
// The inner pie
DataSeries innerSeries = new DataSeries();
innerSeries.setName("Browsers");
PlotOptionsPie innerPieOptions = new PlotOptionsPie();
innerPieOptions.setSize("60%");
innerSeries.setPlotOptions(innerPieOptions);
DataSeries outerSeries = new DataSeries();
outerSeries.setName("Versions");
PlotOptionsPie outerSeriesOptions = new PlotOptionsPie();
outerSeriesOptions.setInnerSize("60%");
outerSeries.setPlotOptions(outerSeriesOptions);
}
use of com.vaadin.addon.charts.model.PlotOptionsPie in project charts by vaadin.
the class BasicUse method basicUse3dPlotoptionsSnippet1.
public void basicUse3dPlotoptionsSnippet1() {
Chart chart = new Chart(ChartType.PIE);
Configuration conf = chart.getConfiguration();
// Set some plot options
PlotOptionsPie options = new PlotOptionsPie();
// Our pie is quite thick
options.setDepth(45);
conf.setPlotOptions(options);
}
Aggregations