A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
vcardona
- Posts: 10
- Joined: Tue Mar 29, 2005 9:31 pm
Post
by vcardona » Wed Mar 30, 2005 5:30 pm
I am using the example in the developer's guide to change the standard tick units so that they display integer values only. However, I would like to be able to toggle that behavior, so I wrote the folllowing code.
Code: Select all
CategoryPlot plot = chart.getCategoryPlot();
NumberAxis axis = (NumberAxis) plot.getRangeAxis();
TickUnits units = (this.chkLabelInts.isSelected()) ? (TickUnits) NumberAxis.createIntegerTickUnits() :
(TickUnits) NumberAxis.createStandardTickUnits();
axis.setStandardTickUnits(units);
It will change the tick units to integers, but the reverse doesn't happen. Does anyone have a solution?
Thanks!
-
vcardona
- Posts: 10
- Joined: Tue Mar 29, 2005 9:31 pm
Post
by vcardona » Wed Mar 30, 2005 8:54 pm
OK, I have worked around my problem by calling the fireChartChanged() method. I noticed that the code posted above should work, and firing a chartchagedevent does update the chart panel. My only question now is why are some events (i.e. the first time the tick units are changed) processed as normal, while other events are not. It almost seems as if something is toggling the notify property, but I haven't found anything that would cause that. I am using 1.0.0-pre2 if that makes a difference.
Thanks.
-
david.gilbert
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
-
Contact:
Post
by david.gilbert » Wed Mar 30, 2005 11:23 pm
Yes it should work. I don't have time to set up a test right now, but if you can create a small sample app that demonstrates the problem and file a bug report (at SourceForge) I'll get it fixed.