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;
}
Aggregations