1
votes

I need to develop a Stacked bar chart usinfg JFreeChart that shows values in Percentage and Number. For percentage mode when I am setting range, the values in the range axis changes but the chart gets squished. Please guide me with your valuable suggestions. Thanks in advance

The code

CategoryPlot plot = chart.getCategoryPlot();
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setRange(0, 100);
1

1 Answers

2
votes

As shown in this variation of StackedBarChartDemo2, you should specify (or convert to) percentages in the data model, not in the view. Then you can simply set the range axis label to the percent symbol, %.