I have StackedBarChart with some values. I want that the bars always reach the top but show percentage of their bar.
Like this:
Country A Water 1
Country A Earth 3
Country B Water 3
Country B Earth 6
Now it should show 2 bars, both same size, showing the relation between Water and Earth. It's difficult to explain. I have already this bar charts but with "normal" values.
Percentage Axis
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
If you already have a regular stacked bar chart, then you can modify it like this:
Code: Select all
CategoryPlot plot = (CategoryPlot) chart.getPlot();
StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer();
renderer.setRenderAsPercentages(true);
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

