I have some data which contains small values (i.e. 0.000000002345, 0.000000003355, etc). When I create a XYplot allowing it to create the standard default tick marks, it puts one mark at 0.0000000 and that it is. I need more resolution.
I tried to change the formatter to display in engineering format. But all that does is display the one tick label as 0E0, but still does not show any other ticks.
How can I make it have about 10 marks on the axis. Plus, as I zoom I want it to adjust (just as the default does if my data values are larger).
What I have come up with so far is this:
//take the size of the range and divide by 10 to get 10 equal tick marks. Use engineering format to display.
((NumberAxis)plot.getRangeAxis()).setTickUnit(new NumberTickUnit((plot.getRangeAxis().getUpperBound()-plot.getRangeAxis().getLowerBound())/10,LocalNumberFormat.engNumberFormat));
This works perfectly, except when I zoom in, it does not adjust the tick marks to give me another ten... it just keeps the original ticks so when you zoom you will only see a couple ticks or less depending how far you zoom in.
Thanks
No axis labels when axis data value is tiny
-
- Posts: 15
- Joined: Wed Nov 07, 2007 6:20 pm
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: No axis labels when axis data value is tiny
I need to fix this bad default behaviour. There are various ways to work around it, the simplest is probably to do this:
Code: Select all
axis.setStandardTickUnits(new StandardTickUnitSource());
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- Posts: 15
- Joined: Wed Nov 07, 2007 6:20 pm
Re: No axis labels when axis data value is tiny
David:
What are some of the other ways around this. I used your suggestion until now. It works for the most part, but once you zoom in to 1.1E-9, it will not
display any smaller numbers when zooming further. It still displays about 9 tick marks, but they all say 1.1E-9.
What are some of the other ways around this. I used your suggestion until now. It works for the most part, but once you zoom in to 1.1E-9, it will not
display any smaller numbers when zooming further. It still displays about 9 tick marks, but they all say 1.1E-9.