use of com.vaadin.addon.charts.model.PlotOptionsColumn 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;
}
use of com.vaadin.addon.charts.model.PlotOptionsColumn in project charts by vaadin.
the class GettingStarted method addColumnsSnippet3.
public Chart addColumnsSnippet3(ChartsData data) {
Chart chart = new Chart();
Configuration conf = chart.getConfiguration();
conf.setTitle("Turku, Finland 2013");
conf.getChart().setType(ChartType.LINE);
ListDataProvider<WeatherInfo> dataProvider = new ListDataProvider<>(data.getWeatherData());
DataProviderSeries<WeatherInfo> temp = new DataProviderSeries<>(dataProvider);
temp.setName("Temperature");
temp.setX(WeatherInfo::getInstant);
temp.setY(WeatherInfo::getMaxTemp);
conf.getxAxis().setTitle("Date");
conf.getxAxis().setType(AxisType.DATETIME);
conf.getyAxis().setTitle("Temperature (°C)");
DataProviderSeries<WeatherInfo> humidity = new DataProviderSeries<>(dataProvider);
humidity.setName("Humidity");
humidity.setX(WeatherInfo::getInstant);
humidity.setY(WeatherInfo::getMeanHumidity);
humidity.setPlotOptions(new PlotOptionsColumn());
conf.addSeries(humidity);
conf.addSeries(temp);
YAxis humidityYAxis = new YAxis();
humidityYAxis.setTitle("Humidity (%)");
humidityYAxis.setMin(0);
humidityYAxis.setOpposite(true);
conf.addyAxis(humidityYAxis);
humidity.setyAxis(humidityYAxis);
return chart;
}
Aggregations