How can I set static length of X and Y axis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Elly
Posts: 19
Joined: Tue Jun 07, 2005 2:26 pm
Location: Germany
Contact:

How can I set static length of X and Y axis

Post by Elly » Tue Sep 27, 2005 2:16 pm

Hello,
I want to set static length of X and Y axis.
at the moment the length is controlled automatically depending on data.

is that possible??

thank you in advance
using JFreeChart 1.0.0 rc1, Java 1.4.2

dhchou
Posts: 138
Joined: Tue Jul 05, 2005 11:01 pm

Post by dhchou » Tue Sep 27, 2005 2:27 pm

Are you trying to set a fixed maximum value for your axes? If that is the case, you can use:

ValueAxis.setAutoRange(boolean auto)
ValueAxis.setRange(double lower, double upper)

Set auto range to false and choose the upper and lower bounds you want. NumberAxis is a subclass of ValueAxis.

Daniel

Elly
Posts: 19
Joined: Tue Jun 07, 2005 2:26 pm
Location: Germany
Contact:

Post by Elly » Tue Sep 27, 2005 2:45 pm

thank you very much for the answer!
That is better than I ever thought it could be!! :)
using JFreeChart 1.0.0 rc1, Java 1.4.2

Guest

Post by Guest » Wed Sep 28, 2005 2:11 am

Is there a way to keep length of the axis (specifically the Y axis) static even when zooming?

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 Sep 28, 2005 12:14 pm

Anonymous wrote:Is there a way to keep length of the axis (specifically the Y axis) static even when zooming?
Yes. Try setRangeZoomable(false) in the ChartPanel class.
David Gilbert
JFreeChart Project Leader

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

Guest

Post by Guest » Tue Oct 04, 2005 8:09 am

Is anyone able to give more info on this?

I cannot seem to get it to work, usual method not found compile error, but I have imported the correct libraries.

Possibly i am using it wrong?

axis.setRangeZoomable( false );

is this correct?

Guest

Post by Guest » Thu Oct 06, 2005 4:42 am

/nudge

dhchou
Posts: 138
Joined: Tue Jul 05, 2005 11:01 pm

Post by dhchou » Thu Oct 06, 2005 3:57 pm

You are calling the setRangeZoomable method with your axis instance.

Dave's post mentioned using setRangeZoomable with your ChartPanel instance.

Daniel

wzwei28
Posts: 105
Joined: Wed Mar 16, 2005 9:17 am
Location: Malaysia, Earth
Contact:

Post by wzwei28 » Fri Nov 18, 2005 10:20 am

Something like this:

public JCandlestickChartDemo1(String s)
{
super(s);
OHLCDataset ohlcdataset = createDataset();
JFreeChart jfreechart = createChart(ohlcdataset);
jfreechart.getXYPlot().setOrientation(PlotOrientation.VERTICAL);
ChartPanel chartpanel = new ChartPanel(jfreechart);

chartpanel.setRangeZoomable(false); //keyline

chartpanel.setPreferredSize(new Dimension(500, 270));
setContentPane(chartpanel);
}

wzwei28
Posts: 105
Joined: Wed Mar 16, 2005 9:17 am
Location: Malaysia, Earth
Contact:

Post by wzwei28 » Fri Nov 18, 2005 10:21 am

Something like this:

public JCandlestickChartDemo1(String s)
{
super(s);
OHLCDataset ohlcdataset = createDataset();
JFreeChart jfreechart = createChart(ohlcdataset);
jfreechart.getXYPlot().setOrientation(PlotOrientation.VERTICAL);
ChartPanel chartpanel = new ChartPanel(jfreechart);

chartpanel.setRangeZoomable(false); //keyline
chartpanel.setPreferredSize(new Dimension(500, 270));
setContentPane(chartpanel);
}

Locked