Get mouse zoom action and replicated to others graphics

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
paolobacci
Posts: 3
Joined: Thu Apr 14, 2011 4:34 pm
antibot: No, of course not.

Get mouse zoom action and replicated to others graphics

Post by paolobacci » Thu Apr 14, 2011 4:45 pm

Hi,
I have 6 different XY time series graphics, one above each other, in one panel.
From the start I already took care to set the same domain range to each one of them so they have always the same "time space"

Code: Select all

for (graphics){
      DateAxis x = (DateAxis) graphic.getChart().getXYPlot().getDomainAxis();
      x.setLowerBound(chartBounds[0]);
      x.setUpperBound(chartBounds[1]);}
But now I want to go deeper.

When I zoom in by dragging the mouse over the chart I'd like to get this new time space set to this chart and replicate to the other ones.
so if the default time range to all is 2001 - 2011 and I zoom in to 2003 - 2006 in one of them, I'd like to set it to all of them only zooming in the X, not the Y axis.
And, of course, when I zoom out I'd like to set the default time space range again (it's a global variable, just have to know the exactly moment to readjust the bounds!)

I tried to set a changeListener on each graphic but I got a Exception stackOverFlow because, of course, each try to rearrange the time space will be caught by the changeListener. So is there a way to know that I zoomed in with the mouse? So I can replicated to the others but ignoring the listener if it isn't mouse dragged or any ideas are welcome to work this out.


thank you!

Locked