Search in sources :

Example 21 with PlotOptionsPie

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;
}
Also used : Configuration(com.vaadin.addon.charts.model.Configuration) SolidColor(com.vaadin.addon.charts.model.style.SolidColor) Marker(com.vaadin.addon.charts.model.Marker) PlotOptionsSpline(com.vaadin.addon.charts.model.PlotOptionsSpline) XAxis(com.vaadin.addon.charts.model.XAxis) HTMLLabels(com.vaadin.addon.charts.model.HTMLLabels) HTMLLabelItem(com.vaadin.addon.charts.model.HTMLLabelItem) PlotOptionsPie(com.vaadin.addon.charts.model.PlotOptionsPie) PlotOptionsColumn(com.vaadin.addon.charts.model.PlotOptionsColumn) Style(com.vaadin.addon.charts.model.style.Style) DataSeries(com.vaadin.addon.charts.model.DataSeries) Chart(com.vaadin.addon.charts.Chart) DataSeriesItem(com.vaadin.addon.charts.model.DataSeriesItem)

Example 22 with PlotOptionsPie

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;
}
Also used : PlotOptionsPie(com.vaadin.addon.charts.model.PlotOptionsPie) ContainerDataSeries(com.vaadin.v7.addon.charts.model.ContainerDataSeries)

Example 23 with PlotOptionsPie

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;
}
Also used : PlotOptionsPie(com.vaadin.addon.charts.model.PlotOptionsPie) Configuration(com.vaadin.addon.charts.model.Configuration) Chart(com.vaadin.addon.charts.Chart)

Example 24 with PlotOptionsPie

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);
}
Also used : PlotOptionsPie(com.vaadin.addon.charts.model.PlotOptionsPie) DataSeries(com.vaadin.addon.charts.model.DataSeries)

Example 25 with PlotOptionsPie

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);
}
Also used : PlotOptionsPie(com.vaadin.addon.charts.model.PlotOptionsPie) Configuration(com.vaadin.addon.charts.model.Configuration) Chart(com.vaadin.addon.charts.Chart)

Aggregations

PlotOptionsPie (com.vaadin.addon.charts.model.PlotOptionsPie)25 Configuration (com.vaadin.addon.charts.model.Configuration)20 Chart (com.vaadin.addon.charts.Chart)19 DataSeries (com.vaadin.addon.charts.model.DataSeries)14 DataLabels (com.vaadin.addon.charts.model.DataLabels)12 DataSeriesItem (com.vaadin.addon.charts.model.DataSeriesItem)11 SolidColor (com.vaadin.addon.charts.model.style.SolidColor)5 Tooltip (com.vaadin.addon.charts.model.Tooltip)3 PointClickEvent (com.vaadin.addon.charts.PointClickEvent)2 PointClickListener (com.vaadin.addon.charts.PointClickListener)2 YAxis (com.vaadin.addon.charts.model.YAxis)2 Color (com.vaadin.addon.charts.model.style.Color)2 Style (com.vaadin.addon.charts.model.style.Style)2 LegendItemClickEvent (com.vaadin.addon.charts.LegendItemClickEvent)1 LegendItemClickListener (com.vaadin.addon.charts.LegendItemClickListener)1 Credits (com.vaadin.addon.charts.model.Credits)1 DataProviderSeries (com.vaadin.addon.charts.model.DataProviderSeries)1 DrillUpButton (com.vaadin.addon.charts.model.DrillUpButton)1 DrillUpButtonTheme (com.vaadin.addon.charts.model.DrillUpButtonTheme)1 Drilldown (com.vaadin.addon.charts.model.Drilldown)1