use of com.vaadin.addon.charts.model.DataSeriesItem in project charts by vaadin.
the class ColumnWithNativeLazyDrilldownMultipleSeries method createSeries.
private void createSeries(int index) {
DataSeries series = new DataSeries();
DataSeriesItem item = new DataSeriesItem("MSIE", 55.11 - index - index - index);
item.setId("MSIE" + index);
series.addItemWithDrilldown(item);
item = new DataSeriesItem("Firefox", 21.63 - index);
item.setId("Firefox" + index);
series.addItemWithDrilldown(item);
item = new DataSeriesItem("Chrome", 11.94 + index);
item.setId("Chrome" + index);
series.addItemWithDrilldown(item);
item = new DataSeriesItem("Safari", 7.15 + index + index);
item.setId("Safari" + index);
series.addItemWithDrilldown(item);
item = new DataSeriesItem("Opera", 2.14 + index);
item.setId("Opera" + index);
series.addItemWithDrilldown(item);
conf.addSeries(series);
}
use of com.vaadin.addon.charts.model.DataSeriesItem in project charts by vaadin.
the class PointClickCoordinatesDonutChart method createOuterSeries.
private Series createOuterSeries() {
DataSeries outerSeries = new DataSeries();
outerSeries.setName("Versions");
PlotOptionsPie outerSeriesOptions = new PlotOptionsPie();
outerSeries.setPlotOptions(outerSeriesOptions);
outerSeriesOptions.setInnerSize("237px");
outerSeriesOptions.setSize("318px");
outerSeriesOptions.setDataLabels(new DataLabels());
outerSeriesOptions.getDataLabels().setFormatter("this.y > 1 ? '<b>'+ this.point.name +':</b> '+ this.y +'%' : null");
DataSeriesItem[] outerItems = new DataSeriesItem[] { /* @formatter:off */
new DataSeriesItem("MSIE 6.0", 10.85, color(0)), new DataSeriesItem("MSIE 7.0", 7.35, color(0)), new DataSeriesItem("MSIE 8.0", 33.06, color(0)), new DataSeriesItem("MSIE 9.0", 2.81, color(0)), new DataSeriesItem("Firefox 2.0", 0.20, color(1)), new DataSeriesItem("Firefox 3.0", 0.83, color(1)), new DataSeriesItem("Firefox 3.5", 1.58, color(1)), new DataSeriesItem("Firefox 3.6", 13.12, color(1)), new DataSeriesItem("Firefox 4.0", 5.43, color(1)), new DataSeriesItem("Chrome 5.0", 0.12, color(2)), new DataSeriesItem("Chrome 6.0", 0.19, color(2)), new DataSeriesItem("Chrome 7.0", 0.12, color(2)), new DataSeriesItem("Chrome 8.0", 0.36, color(2)), new DataSeriesItem("Chrome 9.0", 0.32, color(2)), new DataSeriesItem("Chrome 10.0", 9.91, color(2)), new DataSeriesItem("Chrome 11.0", 0.50, color(2)), new DataSeriesItem("Chrome 12.0", 0.22, color(2)), new DataSeriesItem("Safari 5.0", 4.55, color(3)), new DataSeriesItem("Safari 4.0", 1.42, color(3)), new DataSeriesItem("Safari Win 5.0", 0.23, color(3)), new DataSeriesItem("Safari 4.1", 0.21, color(3)), new DataSeriesItem("Safari/Maxthon", 0.20, color(3)), new DataSeriesItem("Safari 3.1", 0.19, color(3)), new DataSeriesItem("Safari 4.1", 0.14, color(3)), new DataSeriesItem("Opera 9.x", 0.12, color(4)), new DataSeriesItem("Opera 10.x", 0.37, color(4)), new DataSeriesItem("Opera 11.x", 1.65, color(4)) /* @formatter:on */
};
outerSeries.setData(Arrays.asList(outerItems));
return outerSeries;
}
use of com.vaadin.addon.charts.model.DataSeriesItem in project charts by vaadin.
the class PointClickCoordinatesPieChart method addSeries.
@Override
public void addSeries(Configuration conf) {
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.addSeries(series);
}
use of com.vaadin.addon.charts.model.DataSeriesItem in project charts by vaadin.
the class RangeSelectorButtons method getChart.
@Override
protected Component getChart() {
final Chart chart = new Chart();
chart.setHeight("450px");
chart.setWidth("100%");
chart.setTimeline(true);
Configuration configuration = chart.getConfiguration();
YAxis yAxis = new YAxis();
PlotLine plotLine = new PlotLine();
plotLine.setValue(2);
plotLine.setWidth(2);
plotLine.setColor(SolidColor.SILVER);
yAxis.setPlotLines(plotLine);
configuration.addyAxis(yAxis);
DataSeries aaplSeries = new DataSeries();
for (StockPrices.PriceData data : StockPrices.fetchAaplPrice()) {
DataSeriesItem item = new DataSeriesItem();
item.setX(data.getDate());
item.setY(data.getPrice());
aaplSeries.add(item);
}
configuration.setSeries(aaplSeries);
RangeSelector rangeSelector = new RangeSelector();
rangeSelector.setSelected(1);
RangeSelectorButton button = new RangeSelectorButton(MONTH, 3, "D");
DataGrouping grouping = new DataGrouping();
grouping.setForced(true);
grouping.setUnits(new TimeUnitMultiples(TimeUnit.DAY, 1));
button.setDataGrouping(grouping);
rangeSelector.addButton(button);
button = new RangeSelectorButton(YEAR, 1, "W");
grouping = new DataGrouping();
grouping.setForced(true);
grouping.setUnits(new TimeUnitMultiples(TimeUnit.WEEK, 1));
button.setDataGrouping(grouping);
rangeSelector.addButton(button);
button = new RangeSelectorButton(ALL, "M");
grouping = new DataGrouping();
grouping.setForced(true);
grouping.setUnits(new TimeUnitMultiples(TimeUnit.MONTH, 1));
button.setDataGrouping(grouping);
rangeSelector.addButton(button);
configuration.setRangeSelector(rangeSelector);
chart.drawChart(configuration);
return chart;
}
use of com.vaadin.addon.charts.model.DataSeriesItem in project charts by vaadin.
the class SingleLineSeries method getChart.
@Override
protected Component getChart() {
final Chart chart = new Chart();
chart.setHeight("450px");
chart.setWidth("100%");
chart.setTimeline(true);
Configuration configuration = chart.getConfiguration();
configuration.getTitle().setText("AAPL Stock Price");
DataSeries dataSeries = new DataSeries();
for (StockPrices.PriceData data : StockPrices.fetchAaplPrice()) {
DataSeriesItem item = new DataSeriesItem();
item.setX(data.getDate());
item.setY(data.getPrice());
dataSeries.add(item);
}
configuration.setSeries(dataSeries);
RangeSelector rangeSelector = new RangeSelector();
rangeSelector.setSelected(1);
configuration.setRangeSelector(rangeSelector);
chart.drawChart(configuration);
return chart;
}
Aggregations