addChart(chart);
}
private void showBarWithNegStack() {
InvientChartsConfig chartConfig = new InvientChartsConfig();
chartConfig.getGeneralChartConfig().setType(SeriesType.BAR);
chartConfig.getTitle().setText(
"Population pyramid for Germany, midyear 2010");
chartConfig.getSubtitle().setText("Source: www.census.gov");
CategoryAxis xAxisMain = new CategoryAxis();
List<String> categories = Arrays.asList("0-4", "5-9", "10-14", "15-19",
"20-24", "25-29", "30-34", "35-39", "40-44", "45-49", "50-54",
"55-59", "60-64", "65-69", "70-74", "75-79", "80-84", "85-89",
"90-94", "95-99", "100 +");
xAxisMain.setCategories(categories);
xAxisMain.setReversed(false);
LinkedHashSet<XAxis> xAxesSet = new LinkedHashSet<InvientChartsConfig.XAxis>();
// Opposite axis
xAxesSet.add(xAxisMain);
CategoryAxis xAxis = new CategoryAxis();
xAxis.setCategories(categories);
xAxis.setOpposite(true);
xAxis.setReversed(false);
xAxis.setLinkedTo(xAxisMain);
xAxesSet.add(xAxis);
chartConfig.setXAxes(xAxesSet);
NumberYAxis yAxis = new NumberYAxis();
yAxis.setTitle(new AxisTitle(""));
yAxis.setMin(-4000000.0);
yAxis.setMax(4000000.0);
yAxis.setLabel(new YAxisDataLabel());
yAxis.getLabel().setFormatterJsFunc(
"function() {"
+ " return (Math.abs(this.value) / 1000000) + 'M';"
+ " }");
LinkedHashSet<YAxis> yAxesSet = new LinkedHashSet<InvientChartsConfig.YAxis>();
yAxesSet.add(yAxis);
chartConfig.setYAxes(yAxesSet);
Tooltip tooltip = new Tooltip();
tooltip.setFormatterJsFunc("function() {"
+ " return '<b>'+ this.series.name +', age '+ this.point.category +'</b><br/>' + "
+ " 'Population: '+ Highcharts.numberFormat(Math.abs(this.point.y), 0); "
+ "}");
SeriesConfig series = new SeriesConfig();
series.setStacking(Stacking.NORMAL);
chartConfig.addSeriesConfig(series);
InvientCharts chart = new InvientCharts(chartConfig);
XYSeries seriesData = new XYSeries("Male");
seriesData.setSeriesPoints(getPoints(seriesData, -1746181, -1884428,