points.add(new DecimalPoint(series));
}
}
private void showAreaSpline() {
InvientChartsConfig chartConfig = new InvientChartsConfig();
chartConfig.getGeneralChartConfig().setType(SeriesType.AREASPLINE);
chartConfig.getTitle().setText(
"Average fruit consumption during one week");
Legend legend = new Legend();
legend.setLayout(Layout.VERTICAL);
Position legendPos = new Position();
legendPos.setAlign(HorzAlign.LEFT);
legendPos.setVertAlign(VertAlign.TOP);
legendPos.setX(150);
legendPos.setY(100);
legend.setPosition(legendPos);
legend.setFloating(true);
legend.setBorderWidth(1);
legend.setBackgroundColor(new RGB(255, 255, 255));
chartConfig.setLegend(legend);
CategoryAxis xAxis = new CategoryAxis();
xAxis.setCategories(Arrays.asList("Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday", "Sunday"));
NumberPlotBand plotBand = new NumberPlotBand("sat-sun");
plotBand.setRange(new NumberRange(4.6, 6.5));
plotBand.setColor(new RGBA(68, 170, 213, 0.2f));
xAxis.addPlotBand(plotBand);
LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
xAxesSet.add(xAxis);
chartConfig.setXAxes(xAxesSet);
NumberYAxis yAxis = new NumberYAxis();
yAxis.setTitle(new AxisTitle("Fruit units"));
LinkedHashSet<YAxis> yAxesSet = new LinkedHashSet<InvientChartsConfig.YAxis>();
yAxesSet.add(yAxis);
chartConfig.setYAxes(yAxesSet);
chartConfig.getCredit().setEnabled(false);
AreaSplineConfig areaSpline = new AreaSplineConfig();
areaSpline.setFillOpacity(0.5);
chartConfig.addSeriesConfig(areaSpline);
InvientCharts chart = new InvientCharts(chartConfig);
XYSeries series = new XYSeries("John");
series.setSeriesPoints(getPoints(series, 3, 4, 3, 5, 4, 10, 12));
chart.addSeries(series);