Constant plot-position when setting axis visibility?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
patb
Posts: 11
Joined: Sun Aug 03, 2008 7:55 pm

Constant plot-position when setting axis visibility?

Post by patb » Sat Mar 26, 2011 12:03 am

Hello,

I have a simple XYPlot in a ChartPanel with two range axis (one left and one right). For that plot, I let the user set the visibility for one of the range axis.
However, when I hide a range axis, the plot will resize to use more space, of course.

Is it possible to set a constant drawing "position" for that plot, so it does not resize when I show or hide one of the range axis (that way, the plot does not "jump" on showing/hiding an axis)?

Thanks a lot for your help!

Best regards,
Ben

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: Constant plot-position when setting axis visibility?

Post by paradoxoff » Sat Mar 26, 2011 9:55 am

If you want to see a blank area where the now invisible axis was drawn before, then I have no quick idea.
If you just want to keep the plot area/data area constant and make the JFreeChart shrink when you set an axis to invisible, then I recommend this thread and the earlier threads mentioned therein.

patb
Posts: 11
Joined: Sun Aug 03, 2008 7:55 pm

Re: Constant plot-position when setting axis visibility?

Post by patb » Fri Apr 15, 2011 10:26 pm

paradoxoff wrote:If you want to see a blank area where the now invisible axis was drawn before, then I have no quick idea.
Maybe I could just override the ChartPanel / Chart / Plot (whereever the correct location is) and instead of making the axis invisible, just set it's color to transparent (so JFreeChart does think the axis is still there and does not change the size of the plot). Or is there already a property to set the color of the axis / axis labels?

Locked