use of com.vaadin.addon.charts.Chart in project charts by vaadin.
the class ChartTypes method chartTypePolarSnippet1.
public void chartTypePolarSnippet1() {
// Create a chart of some type
Chart chart = new Chart(ChartType.LINE);
// Enable the polar projection
Configuration conf = chart.getConfiguration();
conf.getChart().setPolar(true);
}
use of com.vaadin.addon.charts.Chart in project charts by vaadin.
the class ChartTypes method chartTypesOhlcSnippet2.
public void chartTypesOhlcSnippet2() {
Chart chart = new Chart(ChartType.OHLC);
Configuration configuration = chart.getConfiguration();
// Create a DataProvider filled with stock price data
DataProvider<OhlcData, ?> dataProvider = initDataProvider();
// Wrap the container in a data series
DataProviderSeries<OhlcData> dataSeries = new DataProviderSeries<>(dataProvider);
dataSeries.setX(OhlcData::getDate);
dataSeries.setLow(OhlcData::getLow);
dataSeries.setHigh(OhlcData::getHigh);
dataSeries.setClose(OhlcData::getClose);
dataSeries.setOpen(OhlcData::getOpen);
PlotOptionsOhlc plotOptionsOhlc = new PlotOptionsOhlc();
plotOptionsOhlc.setTurboThreshold(0);
dataSeries.setPlotOptions(plotOptionsOhlc);
configuration.setSeries(dataSeries);
}
use of com.vaadin.addon.charts.Chart in project charts by vaadin.
the class ChartTypes method chartTypesWaterfallDataModel.
public void chartTypesWaterfallDataModel() {
// Define the colors
Chart chart = new Chart();
Configuration conf = chart.getConfiguration();
// The data
DataSeries series = new DataSeries();
// The beginning balance
DataSeriesItem start = new DataSeriesItem("Start", 306503);
SolidColor balanceColor = SolidColor.KHAKI;
start.setColor(balanceColor);
series.add(start);
// Deltas
series.add(new DataSeriesItem("Predators", -3330));
series.add(new DataSeriesItem("Slaughter", -103332));
series.add(new DataSeriesItem("Reproduction", +104052));
WaterFallSum end = new WaterFallSum("End");
end.setColor(balanceColor);
// Not intermediate (default)
end.setIntermediate(false);
series.add(end);
conf.addSeries(series);
}
use of com.vaadin.addon.charts.Chart in project charts by vaadin.
the class ChartTypes method chartTypesSolidGaugeConfSnippet2.
public void chartTypesSolidGaugeConfSnippet2() {
Chart chart = new Chart(ChartType.SOLIDGAUGE);
Configuration conf = chart.getConfiguration();
Pane pane = conf.getPane();
Background bkg = new Background();
// Gray
bkg.setBackgroundColor(new SolidColor("#eeeeee"));
// To make it an arc and not circle
bkg.setInnerRadius("60%");
// Default - not necessary
bkg.setOuterRadius("100%");
// solid or arc
bkg.setShape("arc");
pane.setBackground(bkg);
}
use of com.vaadin.addon.charts.Chart in project charts by vaadin.
the class ChartTypes method chartTypesSolidGaugeSnippet1.
public void chartTypesSolidGaugeSnippet1() {
Chart chart = new Chart(ChartType.SOLIDGAUGE);
chart.setWidth("400px");
chart.setHeight("400px");
}
Aggregations