Reputation: 2724
I'm facing an issue using PolarPlot with jFreeChart. My code plots a single dot with an arbitrary angle and a radius of maximum 1. Everytime I redraw the plot, the number of radial grid lines changes. This makes the program very ugly.
How can I constrain the number of lines to a predefined number?
Upvotes: 1
Views: 136
Reputation: 2724
So I found a satisfying solution:
final JFreeChart chart = ChartFactory.createPolarChart("", dataset, true, true, false);
final PolarPlot plot = (PolarPlot) chart.getPlot();
((NumberAxis)plot.getAxis()).setTickUnit(new NumberTickUnit(0.25));
plot.getAxis().setRange(-1, 1);
Important is the last line, where you set the Range, else if you only plot one single dot the spacing is correct, but the plot will be scaled and the plotted dot lies on the border.
Upvotes: 1