Disable zooming

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Rudi23
Posts: 7
Joined: Tue Nov 06, 2007 10:00 am

Disable zooming

Post by Rudi23 » Tue Nov 06, 2007 10:08 am

Hello,

I'm new to JFreeChart and very happy about having such a powerful framework.

One question: I'm using the class org.jfree.experimental.chart.swt.ChartComposite to use JFreeChart with SWT. Everyting works fine so far. Could anyone please tell me, how I can disable the zoom-feature. Can I do this over the ChartComposite-object or over the embedded JFreeChart-object?

Thank you in advance,
Rudi

Rudi23
Posts: 7
Joined: Tue Nov 06, 2007 10:00 am

Post by Rudi23 » Thu Nov 08, 2007 9:01 am

Hello,

this question ist still important for me. If anyone can help me, please post an answer.

Thanks a lot,
Rudi

zhoupo
Posts: 7
Joined: Sat Nov 03, 2007 6:58 am

Post by zhoupo » Fri Nov 09, 2007 3:03 am

Hello, there's a method named zoom(……) in the class ChartPanel. I guess that's an entry point for you.

Rudi23
Posts: 7
Joined: Tue Nov 06, 2007 10:00 am

Post by Rudi23 » Fri Nov 09, 2007 8:59 am

Hello zhoupo,

thank you for your help. I don't use a ChartPanel because I'm working with SWT, so I'm using a ChartComposite.

You hint helped anyway. I overrided two methods in ChartComposite like this:

chartComposite = new ChartComposite(this, SWT.NONE, null, false){

@Override
public void zoom(Rectangle selection) {

return;
}


@Override
public void restoreAutoBounds() {

return;
}
};


The method zoom() is called, when the user zooms in and restoreAutoBounds() is called, when the user zooms out. So, overriding this methods whith an empty body solves my problem.

Thanks a lot,
Rudi

anirudhak
Posts: 15
Joined: Thu Apr 30, 2009 11:06 am

Re: Disable zooming

Post by anirudhak » Wed May 13, 2009 10:21 am

its very easy ...,
while create chart composite ..,
it has one constructor which will disable the zoom
just use that one .

elskwi
Posts: 1
Joined: Thu Aug 06, 2009 2:20 pm
antibot: No, of course not.

Re: Disable zooming

Post by elskwi » Thu Aug 06, 2009 2:25 pm

Hi,

To disable zoom, for an XY chart

getYourChartPanel().setDomainZoomable(true|false);
getYourChartPanel().setRangeZoomable(true|false);

@See :
http://www.jfree.org/jfreechart/api/jav ... e(boolean)
http://www.jfree.org/jfreechart/api/jav ... e(boolean)

michael watts
Posts: 3
Joined: Tue Feb 15, 2011 2:40 pm
antibot: No, of course not.

Re: Disable zooming

Post by michael watts » Wed Dec 07, 2011 5:21 pm

We have found that if you create a panel with a blank chart ( which we do before we know what data the user wants to display ) and then do setDataSeries() on the plot, the ChartPanel switches zoomable on for both axes. The workaround is to call

Code: Select all

chartPanel().setDomainZoomable(false);
chartPanel().setRangeZoomable(false);
_after_ the call to setDataSeries()

Locked