How to set range axis values as 0 -100 for StackedbarChart using JFreeChart?
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. Tha开发者_如何学Cnks in advance
The code
CategoryPlot plot = chart.getCategoryPlot();
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setRange(0, 100);
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, %
.
精彩评论