use of com.vaadin.addon.charts.Sparkline in project charts by vaadin.
the class SparklineExampleWithLargeDataset method getChart.
@Override
protected Component getChart() {
List<StockData> data = new LinkedList<StockData>();
for (int i = 0; i < 200; i++) {
data.addAll(getStockData());
}
Container container = new BeanItemContainer<StockData>(StockData.class, data);
Table table = new Table();
table.setContainerDataSource(container);
table.addGeneratedColumn("values", new Table.ColumnGenerator() {
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
return new Sparkline(100, 20, (Number[]) source.getItem(itemId).getItemProperty(columnId).getValue());
}
});
table.setVisibleColumns("month", "values", "latest");
table.setHeightUndefined();
return table;
}
use of com.vaadin.addon.charts.Sparkline in project charts by vaadin.
the class SimpleSparklineExample method getChart.
@Override
protected Component getChart() {
Container container = new BeanItemContainer<StockData>(StockData.class, getStockData());
Table table = new Table();
table.setContainerDataSource(container);
table.addGeneratedColumn("values", new Table.ColumnGenerator() {
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
return new Sparkline(100, 20, (Number[]) source.getItem(itemId).getItemProperty(columnId).getValue());
}
});
table.setVisibleColumns("month", "values", "latest");
table.setHeightUndefined();
return table;
}
Aggregations