use of com.vaadin.v7.addon.charts.model.ContainerDataSeries in project charts by vaadin.
the class ContainerSeriesWithHighAndLow method getChart.
@Override
protected Component getChart() {
Chart chart = new Chart(ChartType.COLUMNRANGE);
Configuration conf = chart.getConfiguration();
conf.getChart().setInverted(true);
conf.setTitle("Temperature variation by month");
conf.setSubTitle("Observed in Vik i Sogn, Norway, 2009");
XAxis xAxis = new XAxis();
xAxis.setCategories("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
conf.addxAxis(xAxis);
YAxis yAxis = new YAxis();
yAxis.setTitle("Temperature ( °C )");
conf.addyAxis(yAxis);
Tooltip tooltip = new Tooltip();
tooltip.setValueSuffix("°C");
conf.setTooltip(tooltip);
PlotOptionsColumnrange columnRange = new PlotOptionsColumnrange();
columnRange.setDataLabels(new DataLabelsRange(true));
columnRange.getDataLabels().setFormatter("function() {return this.y + '°C';}");
conf.setPlotOptions(columnRange);
conf.getLegend().setEnabled(false);
IndexedContainer vaadinContainer = new IndexedContainer();
vaadinContainer.addContainerProperty("min", Number.class, null);
vaadinContainer.addContainerProperty("max", Number.class, null);
for (Number[] minMaxPair : getRawData()) {
Item item = vaadinContainer.getItem(vaadinContainer.addItem());
item.getItemProperty("min").setValue(minMaxPair[0]);
item.getItemProperty("max").setValue(minMaxPair[1]);
}
ContainerDataSeries data = new ContainerDataSeries(vaadinContainer);
data.setLowPropertyId("min");
data.setHighPropertyId("max");
data.setName("Temperatures");
conf.setSeries(data);
return chart;
}
use of com.vaadin.v7.addon.charts.model.ContainerDataSeries in project charts by vaadin.
the class ContainerWithLotsOfData method getChart.
@Override
protected Component getChart() {
HorizontalLayout lo = new HorizontalLayout();
ContainerDataSeries container = createContainer();
Component table = createTable(container.getVaadinContainer());
Component chart = createChart(container);
lo.addComponents(table);
lo.addComponent(chart);
table.setSizeFull();
chart.setSizeFull();
lo.setSizeFull();
lo.setExpandRatio(table, 1);
lo.setExpandRatio(chart, 5);
return lo;
}
use of com.vaadin.v7.addon.charts.model.ContainerDataSeries in project charts by vaadin.
the class ContainerSeriesJSONSerializationTest method setup.
@Before
public void setup() {
vaadinContainer = new IndexedContainer();
vaadinContainer.addContainerProperty("y", Number.class, null);
containerSeries = new ContainerDataSeries(vaadinContainer);
}
use of com.vaadin.v7.addon.charts.model.ContainerDataSeries in project charts by vaadin.
the class ChartWithExternalContainer method createContainerView1.
private ContainerDataSeries createContainerView1(Container vaadinContainer) {
ContainerDataSeries container = new ContainerDataSeries(vaadinContainer);
container.setName("Order item quantities");
container.setPlotOptions(new PlotOptionsPie());
container.setYPropertyId(ExampleUtil.ORDER_QUANTITY_PROPERTY_ID);
container.setNamePropertyId(ExampleUtil.ORDER_DESCRIPTION_PROPERTY_ID);
return container;
}
use of com.vaadin.v7.addon.charts.model.ContainerDataSeries in project charts by vaadin.
the class ChartWithExternalContainer method getChart.
@Override
protected Component getChart() {
HorizontalLayout lo = new HorizontalLayout();
lo.setSpacing(true);
Container vaadinContainer = ExampleUtil.getOrderContainer();
ContainerDataSeries container1 = createContainerView1(vaadinContainer);
ContainerDataSeries container2 = createContainerView2(vaadinContainer);
Component table = createTable(vaadinContainer);
Component chart1 = createChart1(container1);
Component chart2 = createChart2(container2);
table.setSizeFull();
chart1.setSizeFull();
chart2.setSizeFull();
lo.setWidth("100%");
lo.setHeight("450px");
lo.addComponents(table);
lo.addComponent(chart1);
lo.addComponent(chart2);
lo.setExpandRatio(table, 0.2f);
lo.setExpandRatio(chart1, 0.4f);
lo.setExpandRatio(chart2, 0.4f);
return lo;
}
Aggregations