use of com.vaadin.addon.charts.model.DataSeries in project charts by vaadin.
the class ChartTypes method chartTypesScatterMarkerPropertiesSnippet1.
public void chartTypesScatterMarkerPropertiesSnippet1() {
double x = 1.0;
double y = 1.2;
double z = 1.45;
DataSeries series = new DataSeries();
DataSeriesItem point = new DataSeriesItem(x, y);
Marker marker = new Marker();
// Set line width and color
// Normally zero width
marker.setLineWidth(1);
marker.setLineColor(SolidColor.BLACK);
// Set RGB fill color
int level = (int) Math.round((1 - z) * 127);
marker.setFillColor(new SolidColor(255 - level, 0, level));
point.setMarker(marker);
marker.setRadius((z + 1) * 5);
series.add(point);
}
use of com.vaadin.addon.charts.model.DataSeries in project charts by vaadin.
the class ChartTypes method chartTypesFlagsExample.
public void chartTypesFlagsExample() {
Chart chart = new Chart(ChartType.SPLINE);
Configuration configuration = chart.getConfiguration();
configuration.getTitle().setText("USD to EUR exchange rate");
configuration.getxAxis().setType(AxisType.DATETIME);
// A data series to annotate with flags
DataSeries dataSeries = new DataSeries();
dataSeries.setId("dataseries");
dataSeries.addData(new Number[][] { { 1434499200000l, 0.8821 }, { 1434585600000l, 0.8802 }, { 1434672000000l, 0.8808 }, { 1434844800000l, 0.8794 }, { 1434931200000l, 0.8818 }, { 1435017600000l, 0.8952 }, { 1435104000000l, 0.8924 }, { 1435190400000l, 0.8925 }, { 1435276800000l, 0.8955 } });
// Flags on the data series
DataSeries flagsOnSeries = new DataSeries();
flagsOnSeries.setName("Flags on series");
PlotOptionsFlags plotOptionsFlags = new PlotOptionsFlags();
plotOptionsFlags.setShape(FlagShape.SQUAREPIN);
plotOptionsFlags.setOnSeries("dataseries");
flagsOnSeries.setPlotOptions(plotOptionsFlags);
flagsOnSeries.add(new FlagItem(1434585600000l, "First Series Flag", "First Series Flag Tooltip Text"));
flagsOnSeries.add(new FlagItem(1435017600000l, "Second Series Flag"));
// Flags on the X axis
DataSeries flagsOnAxis = new DataSeries();
flagsOnAxis.setPlotOptions(new PlotOptionsFlags());
flagsOnAxis.setName("Flags on axis");
flagsOnAxis.add(new FlagItem(1434844800000l, "First Axis Flag", "First Axis Flag Tooltip Text"));
flagsOnAxis.add(new FlagItem(1435190400000l, "Second Axis Flag"));
configuration.setSeries(dataSeries, flagsOnSeries, flagsOnAxis);
}
use of com.vaadin.addon.charts.model.DataSeries in project charts by vaadin.
the class GettingStarted method configuringTheColors.
public void configuringTheColors() {
Chart chart = new Chart();
Configuration conf = chart.getConfiguration();
DataSeries girls = new DataSeries("Girls");
DataSeries boys = new DataSeries("Boys");
PlotOptionsLine girlsOpts = new PlotOptionsLine();
girlsOpts.setColor(SolidColor.HOTPINK);
girls.setPlotOptions(girlsOpts);
PlotOptionsLine boysOpts = new PlotOptionsLine();
boysOpts.setColor(SolidColor.BLUE);
boys.setPlotOptions(boysOpts);
}
use of com.vaadin.addon.charts.model.DataSeries in project charts by vaadin.
the class ChartData method asynchronousDrilldown.
public void asynchronousDrilldown(Chart chart) {
DataSeries series = new DataSeries();
DataSeriesItem mainItem = new DataSeriesItem("MSIE", 55.11);
series.addItemWithDrilldown(mainItem);
chart.setDrilldownCallback(new DrilldownCallback() {
@Override
public Series handleDrilldown(DrilldownEvent event) {
DataSeries drillDownSeries = new DataSeries("MSIE versions");
drillDownSeries.add(new DataSeriesItem("MSIE 6.0", 10.85));
drillDownSeries.add(new DataSeriesItem("MSIE 7.0", 7.35));
drillDownSeries.add(new DataSeriesItem("MSIE 8.0", 33.06));
drillDownSeries.add(new DataSeriesItem("MSIE 9.0", 2.81));
return drillDownSeries;
}
});
}
use of com.vaadin.addon.charts.model.DataSeries in project charts by vaadin.
the class ChartTypes method chartTypesOhlcSnippet1.
public void chartTypesOhlcSnippet1() {
Chart chart = new Chart(ChartType.OHLC);
chart.setTimeline(true);
Configuration configuration = chart.getConfiguration();
configuration.getTitle().setText("AAPL Stock Price");
DataSeries dataSeries = new DataSeries();
Collection<OhlcData> dataBank = null;
for (OhlcData data : dataBank) {
OhlcItem item = new OhlcItem();
item.setX(data.getDate());
item.setLow(data.getLow());
item.setHigh(data.getHigh());
item.setClose(data.getClose());
item.setOpen(data.getOpen());
dataSeries.add(item);
}
configuration.setSeries(dataSeries);
chart.drawChart(configuration);
}
Aggregations