use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.
the class PointClickCoordinatesBarChart method createChart.
@Override
protected Chart createChart() {
Chart chart = super.createChart();
Configuration conf = chart.getConfiguration();
conf.setTitle("Historic World Population by Region");
conf.setSubTitle("Source: Wikipedia.org");
Legend legend = new Legend();
legend.setLabelFormatter("function() { return this.name + ' (click to hide)'; }");
conf.setLegend(legend);
return chart;
}
use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.
the class PointClickCoordinatesPieChart method createChart.
@Override
protected Chart createChart() {
Chart chart = super.createChart();
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();
dataLabels.setEnabled(true);
dataLabels.setFormatter("'<b>'+ this.point.name +'</b>: '+ this.percentage +' %'");
plotOptions.setDataLabels(dataLabels);
conf.setPlotOptions(plotOptions);
chart.drawChart(conf);
return chart;
}
use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.
the class PieChart 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();
dataLabels.setEnabled(true);
dataLabels.setFormatter("'<b>'+ this.point.name +'</b>: '+ this.percentage +' %'");
plotOptions.setDataLabels(dataLabels);
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);
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.Configuration in project charts by vaadin.
the class PieChartCursors method getChart.
@Override
protected Component getChart() {
Chart chart = new Chart(PIE);
Configuration conf = chart.getConfiguration();
conf.setTitle("Browser market shares at a specific website, 2010");
final DataSeries series = new DataSeries();
DataSeriesItem item = new DataSeriesItem("Firefox", 45.0);
item.setCursor("no-drop");
series.add(item);
item = new DataSeriesItem("IE", 26.8);
item.setCursor("none");
series.add(item);
DataSeriesItem chrome = new DataSeriesItem("Chrome", 12.8);
chrome.setCursor("progress");
series.add(chrome);
item = new DataSeriesItem("Safari", 8.5);
item.setCursor("pointer");
series.add(item);
item = new DataSeriesItem("Opera", 6.2);
item.setCursor("move");
series.add(item);
item = new DataSeriesItem("Others", 0.7);
item.setCursor("copy");
series.add(item);
conf.setSeries(series);
return chart;
}
use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.
the class PieChartWithCredits 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");
Credits credits = new Credits("Custom Credit");
credits.setPosition(new Position());
credits.getPosition().setHorizontalAlign(HorizontalAlign.LEFT);
credits.getPosition().setX(200);
conf.setCredits(credits);
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);
conf.setPlotOptions(plotOptions);
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);
chart.drawChart(conf);
return chart;
}
Aggregations