use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.
the class BasicUse method basicUseMixed.
public void basicUseMixed() {
Chart chart = new Chart(ChartType.COLUMN);
Configuration conf = chart.getConfiguration();
// A data series as column graph
DataSeries series1 = new DataSeries();
PlotOptionsColumn options1 = new PlotOptionsColumn();
options1.setColor(SolidColor.BLUE);
series1.setPlotOptions(options1);
series1.setData(4900, 12100, 12800, 6800, 143000, 125000, 51100, 49500);
conf.addSeries(series1);
// A data series as line graph
ListSeries series2 = new ListSeries("Diameter");
PlotOptionsLine options2 = new PlotOptionsLine();
options2.setColor(SolidColor.RED);
series2.setPlotOptions(options2);
series2.setData(4900, 12100, 12800, 6800, 143000, 125000, 51100, 49500);
conf.addSeries(series2);
}
use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.
the class Chart method writeDesign.
@Override
public void writeDesign(Element design, DesignContext designContext) {
super.writeDesign(design, designContext);
Configuration configuration = getConfiguration();
if (configuration != null) {
ChartDesignWriter.writeConfigurationToElement(configuration, design, designContext);
}
}
use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.
the class Chart method readDesign.
@Override
public void readDesign(Element design, DesignContext designContext) {
super.readDesign(design, designContext);
Configuration configuration = getConfiguration();
if (configuration == null) {
configuration = new Configuration();
}
ChartDesignReader.readConfigurationFromElements(design.children(), configuration);
setConfiguration(configuration);
}
use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.
the class Events method getChart.
@Override
protected Component getChart() {
final Chart chart = new Chart();
chart.setHeight("450px");
chart.setWidth("100%");
final Configuration configuration = chart.getConfiguration();
configuration.setTitle("Click to add point");
configuration.getChart().setType(ChartType.SPLINE);
final ListSeries series = new ListSeries(29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4);
configuration.setSeries(series);
chart.drawChart(configuration);
chart.addChartClickListener(new ChartClickListener() {
@Override
public void onClick(ChartClickEvent event) {
double getyAxisValue = event.getyAxisValue();
series.addData(getyAxisValue);
}
});
return chart;
}
use of com.vaadin.addon.charts.model.Configuration in project charts by vaadin.
the class MasterDetailChart method getChart.
@Override
protected Component getChart() {
VerticalLayout lo = new VerticalLayout();
lo.setSpacing(false);
lo.setMargin(false);
lo.setWidth("100%");
lo.setHeight("600px");
final Chart masterChart = getMasterChart();
final Chart detailChart = getDetailChart();
masterChart.addChartSelectionListener(new ChartSelectionListener() {
@Override
public void onSelection(ChartSelectionEvent event) {
long start = event.getSelectionStart().longValue();
long end = event.getSelectionEnd().longValue();
// set plot band to highlight the selection on the master chart
PlotBand plotBand1 = new PlotBand();
PlotBand plotBand2 = new PlotBand();
plotBand1.setColor(new SolidColor(0, 0, 0, 0.2));
plotBand2.setColor(new SolidColor(0, 0, 0, 0.2));
plotBand1.setFrom(Util.toHighchartsTS(DEMO_DATASET_START.atStartOfDay().toInstant(ZoneOffset.UTC)));
plotBand1.setTo(start);
plotBand2.setFrom(end);
plotBand2.setTo(Util.toHighchartsTS(DEMO_DATASET_END.atStartOfDay().toInstant(ZoneOffset.UTC)));
masterChart.getConfiguration().getxAxis().setPlotBands(plotBand1, plotBand2);
masterChart.drawChart();
List<Number> list = MasterDetailChart.this.getPartialList(start, end);
Configuration configuration = detailChart.getConfiguration();
configuration.getChart().setAnimation(false);
ListSeries detailData = (ListSeries) configuration.getSeries().get(0);
PlotOptionsLine plotOptionsLine = (PlotOptionsLine) detailData.getPlotOptions();
plotOptionsLine.setPointStart(start);
detailData.setData(list);
detailChart.drawChart(configuration);
}
});
lo.addComponent(detailChart);
lo.addComponent(masterChart);
return lo;
}
Aggregations