Hi
Im using the Vertical Stacked 3D Bar chart.
I want the Vertical Axis Units to be in the form 0.00 and to jump
by 0.20 .
example: 0, 0.20, 0.40 etc.
How exactly do I do this.
thanks very much,
Ben
vertical axis units
Re: vertical axis units
Hi Ben,
In the NumberAxis class there is a method setTickUnit(...) that will allow you to override the automatic tick selection mechanism and use a fixed tick value. You'll need to do something like this:
BarPlot plot = (BarPlot)myChart.getPlot();
NumberAxis axis = (NumberAxis)plot.getRangeAxis();
NumberTickUnit unit =new NumberTickUnit(new Double(0.2), new DecimalFormat("0.00"));
axis.setTickUnit(unit);
Regards,
Dave Gilbert
In the NumberAxis class there is a method setTickUnit(...) that will allow you to override the automatic tick selection mechanism and use a fixed tick value. You'll need to do something like this:
BarPlot plot = (BarPlot)myChart.getPlot();
NumberAxis axis = (NumberAxis)plot.getRangeAxis();
NumberTickUnit unit =new NumberTickUnit(new Double(0.2), new DecimalFormat("0.00"));
axis.setTickUnit(unit);
Regards,
Dave Gilbert
Re: vertical axis units
hello
i want to create a Bargraph with predifined range on values axis.
after creating the chart as per demo example i wrote this code.
iam getting an error as getRangeAxis() can not resolved.
i have seen online documentaion that this method is not there in
BarPlot or Plot.
how to solve this problem.pl help me immediately
JFreeChart chart = ChartFactory.createVerticalBarChart("Say/Do Metrics tool,IBC",
"Categories", "Values", categoryData, true);
Plot bPlot = (BarPlot)chart.getPlot();
HorizontalCategoryAxis cAxis = (HorizontalCategoryAxis)bPlot.getAxis(Plot.HORIZONTAL_AXIS);
cAxis.setVerticalCategoryLabels(true);
NumberAxis axis = (NumberAxis)bPlot.getRangeAxis();
NumberTickUnit unit =new NumberTickUnit(new Double(0.2), new DecimalFormat("0.00"));
axis.setTickUnit(unit);
i want to create a Bargraph with predifined range on values axis.
after creating the chart as per demo example i wrote this code.
iam getting an error as getRangeAxis() can not resolved.
i have seen online documentaion that this method is not there in
BarPlot or Plot.
how to solve this problem.pl help me immediately
JFreeChart chart = ChartFactory.createVerticalBarChart("Say/Do Metrics tool,IBC",
"Categories", "Values", categoryData, true);
Plot bPlot = (BarPlot)chart.getPlot();
HorizontalCategoryAxis cAxis = (HorizontalCategoryAxis)bPlot.getAxis(Plot.HORIZONTAL_AXIS);
cAxis.setVerticalCategoryLabels(true);
NumberAxis axis = (NumberAxis)bPlot.getRangeAxis();
NumberTickUnit unit =new NumberTickUnit(new Double(0.2), new DecimalFormat("0.00"));
axis.setTickUnit(unit);