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
Disable zooming
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
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
Re: Disable zooming
its very easy ...,
while create chart composite ..,
it has one constructor which will disable the zoom
just use that one .
while create chart composite ..,
it has one constructor which will disable the zoom
just use that one .
Re: Disable zooming
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)
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)
-
- Posts: 3
- Joined: Tue Feb 15, 2011 2:40 pm
- antibot: No, of course not.
Re: Disable zooming
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
_after_ the call to setDataSeries()
Code: Select all
chartPanel().setDomainZoomable(false);
chartPanel().setRangeZoomable(false);