Search in sources :

Example 6 with Frame

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

the class Basic3DColumnWithGradientBackground method getChart.

@Override
protected Component getChart() {
    Chart chart = new Chart(ChartType.COLUMN);
    Configuration conf = chart.getConfiguration();
    conf.setTitle("Monthly Average Rainfall");
    conf.setSubTitle("Source: WorldClimate.com");
    XAxis x = new XAxis();
    x.setCategories(new String[] { "Jan", "Feb", "Mar", "Apr" });
    conf.addxAxis(x);
    YAxis y = new YAxis();
    y.setMin(0);
    y.setTitle("Rainfall (mm)");
    conf.addyAxis(y);
    Tooltip tooltip = new Tooltip();
    tooltip.setFormatter("this.x +': '+ this.y +' mm'");
    conf.setTooltip(tooltip);
    PlotOptionsColumn plot = new PlotOptionsColumn();
    plot.setPointPadding(0.2);
    plot.setBorderWidth(0);
    plot.setGroupZPadding(10);
    conf.setPlotOptions(plot);
    Options3d options3d = new Options3d();
    options3d.setEnabled(true);
    options3d.setAlpha(5);
    options3d.setBeta(30);
    options3d.setDepth(100);
    options3d.setViewDistance(200);
    Frame frame = new Frame();
    options3d.setFrame(frame);
    frame.setBack(new Back());
    GradientColor c = GradientColor.createLinear(0, 0, 1, 0);
    c.addColorStop(0, SolidColor.RED);
    c.addColorStop(1, SolidColor.AQUAMARINE);
    frame.getBack().setColor(c);
    frame.getBack().setSize(1);
    conf.getChart().setOptions3d(options3d);
    conf.addSeries(new ListSeries("Tokyo", 49.9, 71.5, 106.4, 129.2));
    chart.drawChart(conf);
    return chart;
}
Also used : Frame(com.vaadin.addon.charts.model.Frame) Configuration(com.vaadin.addon.charts.model.Configuration) PlotOptionsColumn(com.vaadin.addon.charts.model.PlotOptionsColumn) GradientColor(com.vaadin.addon.charts.model.style.GradientColor) ListSeries(com.vaadin.addon.charts.model.ListSeries) Tooltip(com.vaadin.addon.charts.model.Tooltip) Back(com.vaadin.addon.charts.model.Back) Chart(com.vaadin.addon.charts.Chart) XAxis(com.vaadin.addon.charts.model.XAxis) Options3d(com.vaadin.addon.charts.model.Options3d) YAxis(com.vaadin.addon.charts.model.YAxis)

Aggregations

Frame (com.vaadin.addon.charts.model.Frame)6 Options3d (com.vaadin.addon.charts.model.Options3d)6 Chart (com.vaadin.addon.charts.Chart)5 XAxis (com.vaadin.addon.charts.model.XAxis)5 YAxis (com.vaadin.addon.charts.model.YAxis)4 Bottom (com.vaadin.addon.charts.model.Bottom)3 Configuration (com.vaadin.addon.charts.model.Configuration)3 Back (com.vaadin.addon.charts.model.Back)2 DataSeries (com.vaadin.addon.charts.model.DataSeries)2 ListSeries (com.vaadin.addon.charts.model.ListSeries)2 PlotOptionsColumn (com.vaadin.addon.charts.model.PlotOptionsColumn)2 PlotOptionsScatter (com.vaadin.addon.charts.model.PlotOptionsScatter)2 Tooltip (com.vaadin.addon.charts.model.Tooltip)2 ZAxis (com.vaadin.addon.charts.model.ZAxis)2 GradientColor (com.vaadin.addon.charts.model.style.GradientColor)1