addChart(chart);
}
private void showAreaWithMissingPoints() {
InvientChartsConfig chartConfig = new InvientChartsConfig();
chartConfig.getGeneralChartConfig().setType(SeriesType.AREA);
chartConfig.getGeneralChartConfig().setSpacing(new Spacing());
chartConfig.getGeneralChartConfig().getSpacing().setBottom(30);
chartConfig.getTitle().setText("Fruit consumption *");
chartConfig.getSubtitle().setText(
"* Jane\'s banana consumption is unknown");
chartConfig.getSubtitle().setFloating(true);
chartConfig.getSubtitle().setAlign(HorzAlign.RIGHT);
chartConfig.getSubtitle().setVertAlign(VertAlign.BOTTOM);
chartConfig.getSubtitle().setY(15);
Legend legend = new Legend();
legend.setFloating(true);
legend.setLayout(Layout.VERTICAL);
legend.setPosition(new Position());
legend.getPosition().setAlign(HorzAlign.LEFT);
legend.getPosition().setVertAlign(VertAlign.TOP);
legend.getPosition().setX(150);
legend.getPosition().setY(100);
legend.setBorderWidth(1);
legend.setBackgroundColor(new RGB(255, 255, 255));
chartConfig.setLegend(legend);
CategoryAxis xAxis = new CategoryAxis();
xAxis.setCategories(Arrays.asList("Apples", "Pears", "Oranges",
"Bananas", "Grapes", "Plums", "Strawberries", "Raspberries"));
LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
xAxesSet.add(xAxis);
chartConfig.setXAxes(xAxesSet);
NumberYAxis yAxis = new NumberYAxis();
yAxis.setTitle(new AxisTitle("Y-Axis"));
yAxis.setLabel(new YAxisDataLabel());
yAxis.getLabel().setFormatterJsFunc(
"function() {" + " return this.value; " + "}");
LinkedHashSet<YAxis> yAxesSet = new LinkedHashSet<InvientChartsConfig.YAxis>();
yAxesSet.add(yAxis);
chartConfig.setYAxes(yAxesSet);
chartConfig
.getTooltip()
.setFormatterJsFunc(
"function() {"
+ " return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y;"
+ "}");
chartConfig.getCredit().setEnabled(false);
AreaConfig areaCfg = new AreaConfig();
areaCfg.setFillOpacity(0.5);
chartConfig.addSeriesConfig(areaCfg);
InvientCharts chart = new InvientCharts(chartConfig);
XYSeries series = new XYSeries("John");
series.setSeriesPoints(getPoints(series, 0, 1, 4, 4, 5, 2, 3, 7));