I have a 3D stacked bar chart and i have a problem with rendering it with DefaultCategoryDataset containing one category with 3 series and zero values.
The first image below represents the expected behavior. Ignore the vertical dashed line, it's just an annotation.
The settings I've used for this chart is:
Code: Select all
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setUpperMargin(0d);
rangeAxis.setNumberFormatOverride(new DecimalFormat("0%"));
StackedBarRenderer3D stackedBarRenderer3d = (StackedBarRenderer3D) plot.getRenderer();
stackedBarRenderer3d.setRenderAsPercentages(true);
stackedBarRenderer3d.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
stackedBarRenderer3d.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{3}", NumberFormat.getIntegerInstance(), new DecimalFormat("0.0%")));
stackedBarRenderer3d.setBaseItemLabelsVisible(true);
Code: Select all
numberAxis.setNumberFormatOverride(null);
numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
stackedBarRenderer3d.setRenderAsPercentages(false);
I'm I missing something? Why is the zero value in the middle? And why is there a bar at all? It should look like the first image.
Thanks.