use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class StackedColumn method getChart.
@Override
protected Component getChart() {
Chart chart = new Chart(ChartType.COLUMN);
Configuration conf = chart.getConfiguration();
conf.setTitle(new Title("Stacked column chart"));
XAxis xAxis = new XAxis();
xAxis.setCategories(new String[] { "Apples", "Oranges", "Pears", "Grapes", "Bananas" });
conf.addxAxis(xAxis);
YAxis yAxis = new YAxis();
yAxis.setMin(0);
yAxis.setTitle(new AxisTitle("Total fruit consumption"));
StackLabels sLabels = new StackLabels(true);
yAxis.setStackLabels(sLabels);
conf.addyAxis(yAxis);
Legend legend = new Legend();
legend.setAlign(HorizontalAlign.RIGHT);
legend.setFloating(true);
legend.setVerticalAlign(VerticalAlign.TOP);
legend.setX(-100);
legend.setY(20);
conf.setLegend(legend);
Tooltip tooltip = new Tooltip();
tooltip.setFormatter("function() { return '<b>'+ this.x +'</b><br/>" + "'+this.series.name +': '+ this.y +'<br/>'+'Total: '+ this.point.stackTotal;}");
conf.setTooltip(tooltip);
PlotOptionsColumn plotOptions = new PlotOptionsColumn();
plotOptions.setStacking(Stacking.NORMAL);
DataLabels labels = new DataLabels(true);
Style style = new Style();
style.setTextShadow("0 0 3px black");
labels.setStyle(style);
labels.setColor(new SolidColor("white"));
plotOptions.setDataLabels(labels);
conf.setPlotOptions(plotOptions);
conf.addSeries(new ListSeries("John", new Number[] { 5, 3, 4, 7, 2 }));
conf.addSeries(new ListSeries("Jane", new Number[] { 2, 2, 3, 2, 1 }));
conf.addSeries(new ListSeries("Joe", new Number[] { 3, 4, 4, 2, 5 }));
chart.drawChart(conf);
return chart;
}
use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class BasicBar method getChart.
@Override
protected Component getChart() {
Chart chart = new Chart(ChartType.BAR);
Configuration conf = chart.getConfiguration();
conf.setTitle("Historic World Population by Region");
conf.setSubTitle("Source: Wikipedia.org");
XAxis x = new XAxis();
x.setCategories("Africa", "America", "Asia", "Europe", "Oceania");
x.setTitle((String) null);
conf.addxAxis(x);
YAxis y = new YAxis();
y.setMin(0);
AxisTitle title = new AxisTitle("Population (millions)");
title.setAlign(VerticalAlign.MIDDLE);
y.setTitle(title);
conf.addyAxis(y);
Tooltip tooltip = new Tooltip();
tooltip.setFormatter("this.series.name +': '+ this.y +' millions'");
conf.setTooltip(tooltip);
PlotOptionsBar plot = new PlotOptionsBar();
plot.setDataLabels(new DataLabels(true));
conf.setPlotOptions(plot);
Legend legend = new Legend();
legend.setLayout(LayoutDirection.VERTICAL);
legend.setAlign(HorizontalAlign.RIGHT);
legend.setVerticalAlign(VerticalAlign.TOP);
legend.setX(-100);
legend.setY(100);
legend.setFloating(true);
legend.setBorderWidth(1);
legend.setBackgroundColor(new SolidColor("#FFFFFF"));
legend.setShadow(true);
conf.setLegend(legend);
conf.disableCredits();
List<Series> series = new ArrayList<Series>();
series.add(new ListSeries("Year 1800", 107, 31, 635, 203, 2));
series.add(new ListSeries("Year 1900", 133, 156, 947, 408, 6));
series.add(new ListSeries("Year 2008", 973, 914, 4054, 732, 34));
conf.setSeries(series);
chart.drawChart(conf);
return chart;
}
use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class PointClickCoordinatesColumnChart method createChart.
@Override
protected Chart createChart() {
Chart chart = super.createChart();
Configuration conf = chart.getConfiguration();
conf.setTitle("Total fruit consumption, grouped by gender");
conf.setSubTitle("Source: WorldClimate.com");
XAxis x = new XAxis();
x.setCategories("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
conf.addxAxis(x);
YAxis y = new YAxis();
y.setMin(0);
y.setTitle("Rainfall (mm)");
conf.addyAxis(y);
Legend legend = new Legend();
legend.setLayout(LayoutDirection.VERTICAL);
legend.setBackgroundColor(new SolidColor("#FFFFFF"));
legend.setAlign(HorizontalAlign.LEFT);
legend.setVerticalAlign(VerticalAlign.TOP);
legend.setX(100);
legend.setY(70);
legend.setFloating(true);
legend.setShadow(true);
conf.setLegend(legend);
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);
return chart;
}
use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class PointClickCoordinatesDonutChart method createInnerSeries.
private Series createInnerSeries() {
DataSeries innerSeries = new DataSeries();
innerSeries.setName("Browsers");
PlotOptionsPie innerPieOptions = new PlotOptionsPie();
innerSeries.setPlotOptions(innerPieOptions);
innerPieOptions.setSize("237px");
innerPieOptions.setDataLabels(new DataLabels());
innerPieOptions.getDataLabels().setFormatter("this.y > 5 ? this.point.name : null");
innerPieOptions.getDataLabels().setColor(new SolidColor(255, 255, 255));
innerPieOptions.getDataLabels().setDistance(-30);
Color[] innerColors = Arrays.copyOf(colors, 5);
innerSeries.setData(new String[] { "MSIE", "Firefox", "Chrome", "Safari", "Opera" }, new Number[] { 55.11, 21.63, 11.94, 7.15, 2.14 }, innerColors);
return innerSeries;
}
use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class TreemapWithColorAxis method getChart.
@Override
protected Component getChart() {
Chart chart = new Chart(ChartType.TREEMAP);
ColorAxis colorAxis = new ColorAxis();
colorAxis.setMinColor(new SolidColor("#FFFFFF"));
colorAxis.setMaxColor(new SolidColor("#7BB5EF"));
chart.getConfiguration().addColorAxis(colorAxis);
PlotOptionsTreemap plotOptions = new PlotOptionsTreemap();
plotOptions.setLayoutAlgorithm(TreeMapLayoutAlgorithm.SQUARIFIED);
TreeSeries series = createSeries();
series.setPlotOptions(plotOptions);
chart.getConfiguration().addSeries(series);
chart.getConfiguration().setTitle("Vaadin Charts Treemap");
return chart;
}
Aggregations