BUG: Hide Axis Label axis.setLabel(null) render issue.

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
dymaxion
Posts: 6
Joined: Mon Mar 10, 2008 4:10 pm
Location: London, UK

BUG: Hide Axis Label axis.setLabel(null) render issue.

Post by dymaxion » Mon Apr 21, 2008 10:38 am

I set the Axis Label to null to hide the label text, since can't find any other method for this. As a side effect, the rendering gets messed up. Seems to add a load of whitespace where the label used to be, and also doesn't give enough spacing between multiple axes.

See image attached.
Image

Likewise, if I start a plot without axis labels, then dynamically add the labels at runtime action (when user clicks a button). The chart axis run off the visible area.

Anyone else seen this bug or knows of a workaround?

Thanks,
Spencer

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 » Mon Apr 21, 2008 11:05 am

Does this happen just with the Combined***Plot classes? There is a bug that has been fixed for the upcoming 1.0.10 release that will probably resolve this for you. You could check out the latest code from Subversion and confirm it, or wait for the 1.0.10 release (which I've been trying to get released but keep getting diverted onto other tasks) which I really hope will go up this week.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

dymaxion
Posts: 6
Joined: Mon Mar 10, 2008 4:10 pm
Location: London, UK

Post by dymaxion » Tue Apr 22, 2008 10:42 am

Yes I'm using a CombinedDomain plot.... will try the code from SVN and see what happens... Here's what it looks like when I setVisible(false)

Image

dymaxion
Posts: 6
Joined: Mon Mar 10, 2008 4:10 pm
Location: London, UK

Post by dymaxion » Wed Apr 23, 2008 5:16 pm

Looks like the SVN code seems to fix this bug in v1.0.10
Thanks!


[ But still not convinced by the hashCode method on NumberAxis. Until there's a setLabelVisible(boolean) I have to setLabel(null) which causes problems where different axes have same hashCode ]

/**
* Returns a hash code for this object.
*
* @return A hash code.
*/
public int hashCode() {
if (getLabel() != null) {
return getLabel().hashCode();
}
else {
return 0;
}
}

Locked