use of com.vaadin.addon.charts.model.Options3d in project charts by vaadin.
the class Basic3DColumn 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("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);
conf.getChart().setOptions3d(options3d);
conf.addSeries(new ListSeries("Tokyo", 49.9, 71.5, 106.4, 129.2));
conf.addSeries(new ListSeries("New York", 83.6, 78.8, 98.5, 93.4));
conf.addSeries(new ListSeries("London", 48.9, 38.8, 39.3, 41.4));
conf.addSeries(new ListSeries("Berlin", 42.4, 33.2, 34.5, 39.7));
chart.drawChart(conf);
return chart;
}
use of com.vaadin.addon.charts.model.Options3d in project charts by vaadin.
the class Basic3DPie method createChart.
public static Chart createChart() {
Chart chart = new Chart(ChartType.PIE);
Configuration conf = chart.getConfiguration();
conf.setTitle("Browser market shares at a specific website, 2010");
PlotOptionsPie plotOptions = new PlotOptionsPie();
plotOptions.setCursor(Cursor.POINTER);
DataLabels dataLabels = new DataLabels(true);
dataLabels.setFormatter("'<b>'+ this.point.name +'</b>: '+ this.percentage +' %'");
plotOptions.setDataLabels(dataLabels);
plotOptions.setDepth(45);
conf.setPlotOptions(plotOptions);
final DataSeries series = new DataSeries();
series.add(new DataSeriesItem("Firefox", 45.0));
series.add(new DataSeriesItem("IE", 26.8));
DataSeriesItem chrome = new DataSeriesItem("Chrome", 12.8);
chrome.setSliced(true);
chrome.setSelected(true);
series.add(chrome);
series.add(new DataSeriesItem("Safari", 8.5));
series.add(new DataSeriesItem("Opera", 6.2));
series.add(new DataSeriesItem("Others", 0.7));
conf.setSeries(series);
Options3d options3d = new Options3d();
options3d.setEnabled(true);
options3d.setAlpha(60);
conf.getChart().setOptions3d(options3d);
chart.addPointClickListener(new PointClickListener() {
@Override
public void onClick(PointClickEvent event) {
Notification.show("Click: " + series.get(event.getPointIndex()).getName());
}
});
chart.drawChart(conf);
return chart;
}
use of com.vaadin.addon.charts.model.Options3d in project charts by vaadin.
the class BasicUse method basicUse3dSnippet2.
public void basicUse3dSnippet2() {
Options3d options3d = new Options3d();
Frame frame = new Frame();
Back back = new Back();
back.setColor(SolidColor.BEIGE);
back.setSize(1);
frame.setBack(back);
options3d.setFrame(frame);
}
use of com.vaadin.addon.charts.model.Options3d in project charts by vaadin.
the class BasicUse method basicUse3dDistanceSnippet2.
public void basicUse3dDistanceSnippet2() {
double x = 3.2;
double z = 3.3;
double y = 2.3;
Options3d options3d = new Options3d();
DataSeriesItem3d item = new DataSeriesItem3d(x, y, z * options3d.getDepth().doubleValue());
double distance = 43.2;
// Grayness
int gr = (int) (distance * 75);
Marker marker = new Marker(true);
marker.setRadius(1 + 10 / distance);
marker.setFillColor(new SolidColor(gr, gr, gr));
item.setMarker(marker);
DataSeries series = new DataSeries();
series.add(item);
}
use of com.vaadin.addon.charts.model.Options3d in project charts by vaadin.
the class Basic3DScatter method createScatterChart.
private Chart createScatterChart() {
final Chart scatterChart = new Chart(ChartType.SCATTER);
scatterChart.setId("chart");
scatterChart.getConfiguration().disableCredits();
scatterChart.getConfiguration().setTitle("Points of a sphere");
PlotOptionsScatter scatterOptions = new PlotOptionsScatter();
scatterOptions.setAnimation(false);
scatterOptions.setPointStart(1);
DataSeries higherX = new DataSeries();
higherX.setName("Higher X");
DataSeries higherY = new DataSeries();
higherY.setName("Higher Y");
DataSeries higherZ = new DataSeries();
higherZ.setName("Higher Z");
fillSeries(higherX, higherY, higherZ);
scatterChart.getConfiguration().addSeries(higherX);
scatterChart.getConfiguration().addSeries(higherY);
scatterChart.getConfiguration().addSeries(higherZ);
XAxis x = scatterChart.getConfiguration().getxAxis();
x.setGridLineWidth(1);
x.setExtremes(-3, 3);
if (getCurrentTheme().getxAxis().getGridLineColor() != null) {
x.setGridLineColor(getCurrentTheme().getxAxis().getGridLineColor());
}
YAxis y = scatterChart.getConfiguration().getyAxis();
y.setExtremes(-1, 1);
ZAxis z = scatterChart.getConfiguration().getzAxis();
z.setMin(-1);
z.setMax(1);
Options3d options3d = new Options3d();
options3d.setEnabled(true);
options3d.setAlpha(10);
options3d.setBeta(30);
options3d.setDepth(80);
options3d.setViewDistance(40);
Frame frame = new Frame();
Bottom bottom = new Bottom();
bottom.setSize(1);
frame.setBottom(bottom);
options3d.setFrame(frame);
scatterChart.getConfiguration().getChart().setOptions3d(options3d);
scatterChart.drawChart();
return scatterChart;
}
Aggregations