Hello,
I am building a JFreeChart with an XYSeries.
I have about 10 xy pairs in my XYSeries.
My y values range from 0 to 1.0 and are labeled appropriately in my chart panel.
My x values look something like this -0.04, -0.02, 0.0, 0.02, 0.04, ... etc.
My problem is: my x values, with the exception of 0.0, do not show up as labels along the x axis.
However if I change my dataset so that my x values are 1, 2, 3, 4, etc., then my x axis is labeled (but of course not with the correct values).
So my question is "How do I get values such as -0.02 to show up as labels along the X axis when using an XYSeries?
JFreeChart ver 0.9.3
Java 1.3.1
Windows 2000
Thank you,
Ted Hill
XYSeries.add(double, double);
Re: XYSeries.add(double, double);
Hi Ted,
The axis tick labels are automatically selected from a collection of 'standard' sizes so that there are as many labels as possible without any overlapping. The data you are plotting doesn't come into the equation, since it might or might not have regular spacing in the x-values.
You can force a particular tick size if you want to:
XYPlot plot = myChart.getXYPlot();
NumberAxis axis = (NumberAxis) plot.getDomainAxis();
NumberTickUnit unit = new NumberTickUnit(0.02, myNumberFormat);
axis.setTickUnit(unit);
But now the labels might overlap at some chart sizes.
Regards,
DG.
The axis tick labels are automatically selected from a collection of 'standard' sizes so that there are as many labels as possible without any overlapping. The data you are plotting doesn't come into the equation, since it might or might not have regular spacing in the x-values.
You can force a particular tick size if you want to:
XYPlot plot = myChart.getXYPlot();
NumberAxis axis = (NumberAxis) plot.getDomainAxis();
NumberTickUnit unit = new NumberTickUnit(0.02, myNumberFormat);
axis.setTickUnit(unit);
But now the labels might overlap at some chart sizes.
Regards,
DG.