use of com.vaadin.flow.component.charts.model.PlotOptionsArea in project flow-components by vaadin.
the class Polar method initDemo.
@Override
public void initDemo() {
Chart chart = new Chart();
Configuration conf = chart.getConfiguration();
conf.getChart().setPolar(true);
conf.setTitle("Polar Chart");
Pane pane = new Pane(0, 360);
conf.addPane(pane);
XAxis xAxis = new XAxis();
xAxis.setTickInterval(45);
xAxis.setMin(0);
xAxis.setMax(360);
Labels labels = new Labels();
labels.setFormatter("function() {return this.value + '°';}");
xAxis.setLabels(labels);
YAxis yAxis = new YAxis();
yAxis.setMin(0);
conf.addxAxis(xAxis);
conf.addyAxis(yAxis);
PlotOptionsSeries series = new PlotOptionsSeries();
PlotOptionsColumn column = new PlotOptionsColumn();
series.setPointStart(0);
series.setPointInterval(45);
column.setPointPadding(0);
column.setGroupPadding(0);
conf.setPlotOptions(series, column);
ListSeries col = new ListSeries(8, 7, 6, 5, 4, 3, 2, 1);
ListSeries line = new ListSeries(1, 2, 3, 4, 5, 6, 7, 8);
ListSeries area = new ListSeries(1, 8, 2, 7, 3, 6, 4, 5);
col.setPlotOptions(new PlotOptionsColumn());
col.setName(ChartType.COLUMN.toString());
line.setPlotOptions(new PlotOptionsLine());
line.setName(ChartType.LINE.toString());
area.setPlotOptions(new PlotOptionsArea());
area.setName(ChartType.AREA.toString());
conf.setSeries(col, line, area);
add(chart);
}
use of com.vaadin.flow.component.charts.model.PlotOptionsArea in project flow-components by vaadin.
the class DynamicChangingChart method getPolarConfiguration.
public Configuration getPolarConfiguration() {
Configuration configuration = new Configuration();
configuration.getChart().setPolar(true);
configuration.setTitle("Polar Chart");
Pane pane = new Pane(0, 360);
configuration.addPane(pane);
XAxis xAxis = new XAxis();
xAxis.setTickInterval(45);
xAxis.setMin(0);
xAxis.setMax(360);
Labels labels = new Labels();
labels.setFormatter("function() {return this.value + '°';}");
xAxis.setLabels(labels);
YAxis yAxis = new YAxis();
yAxis.setMin(0);
configuration.addxAxis(xAxis);
configuration.addyAxis(yAxis);
PlotOptionsSeries series = new PlotOptionsSeries();
PlotOptionsColumn column = new PlotOptionsColumn();
series.setPointStart(0);
series.setPointInterval(45);
column.setPointPadding(0);
column.setGroupPadding(0);
configuration.setPlotOptions(series, column);
ListSeries col = new ListSeries(8, 7, 6, 5, 4, 3, 2, 1);
ListSeries line = new ListSeries(1, 2, 3, 4, 5, 6, 7, 8);
ListSeries area = new ListSeries(1, 8, 2, 7, 3, 6, 4, 5);
col.setPlotOptions(new PlotOptionsColumn());
col.setName(ChartType.COLUMN.toString());
line.setPlotOptions(new PlotOptionsLine());
line.setName(ChartType.LINE.toString());
area.setPlotOptions(new PlotOptionsArea());
area.setName(ChartType.AREA.toString());
configuration.setSeries(col, line, area);
return configuration;
}
use of com.vaadin.flow.component.charts.model.PlotOptionsArea in project flow-components by vaadin.
the class AreaSpline method initDemo.
@Override
public void initDemo() {
Chart chart = new Chart(ChartType.AREASPLINE);
Configuration conf = chart.getConfiguration();
conf.setTitle(new Title("Average fruit consumption during one week"));
Legend legend = new Legend();
legend.setLayout(LayoutDirection.VERTICAL);
legend.setAlign(HorizontalAlign.LEFT);
legend.setFloating(true);
legend.setVerticalAlign(VerticalAlign.TOP);
legend.setX(150);
legend.setY(100);
conf.setLegend(legend);
XAxis xAxis = new XAxis();
xAxis.setCategories(new String[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" });
PlotBand plotBand = new PlotBand(4.5, 6.5, SolidColor.BLUE);
plotBand.setZIndex(1);
xAxis.setPlotBands(plotBand);
conf.addxAxis(xAxis);
YAxis yAxis = new YAxis();
yAxis.setTitle(new AxisTitle("Fruit units"));
conf.addyAxis(yAxis);
Tooltip tooltip = new Tooltip();
// Customize tooltip formatting
tooltip.setShared(true);
tooltip.setValueSuffix(" units");
conf.setTooltip(tooltip);
PlotOptionsArea plotOptions = new PlotOptionsArea();
conf.setPlotOptions(plotOptions);
ListSeries o = new ListSeries("John", 3, 4, 3, 5, 4, 10);
// You can also add values separately
o.addData(12);
conf.addSeries(o);
conf.addSeries(new ListSeries("Jane", 1, 3, 4, 3, 3, 5, 4));
add(chart);
}
use of com.vaadin.flow.component.charts.model.PlotOptionsArea in project flow-components by vaadin.
the class Area method initDemo.
@Override
public void initDemo() {
Chart chart = new Chart(ChartType.AREA);
final Configuration configuration = chart.getConfiguration();
configuration.setTitle("Historic and Estimated Worldwide Population Growth by Region");
configuration.setSubTitle("Source: Wikipedia.org");
XAxis xAxis = configuration.getxAxis();
xAxis.setCategories("1750", "1800", "1850", "1900", "1950", "1999", "2050");
xAxis.setTickmarkPlacement(TickmarkPlacement.ON);
YAxis yAxis = configuration.getyAxis();
yAxis.setTitle("Billions");
yAxis.getLabels().setFormatter("function () { return this.value / 1000;}");
configuration.getTooltip().setValueSuffix(" millions");
PlotOptionsArea plotOptionsArea = new PlotOptionsArea();
plotOptionsArea.setStacking(Stacking.NORMAL);
configuration.setPlotOptions(plotOptionsArea);
configuration.addSeries(new ListSeries("Asia", 502, 635, 809, 947, 1402, 3634, 5268));
configuration.addSeries(new ListSeries("Africa", 106, 107, 111, 133, 221, 767, 1766));
configuration.addSeries(new ListSeries("Europe", 163, 203, 276, 408, 547, 729, 628));
configuration.addSeries(new ListSeries("America", 18, 31, 54, 156, 339, 818, 1201));
configuration.addSeries(new ListSeries("Oceania", 2, 2, 2, 6, 13, 30, 46));
add(chart);
}
Aggregations