I have a little problem with the new interactive zooming feature from CVS. It only seems to work for "small windows". Let me explain: in mouseReleased() in ChartPanel.java the zoomArea is calculated using this.info.getDataArea().getMaxX() and getMaxY(). If I resize a chart window those values change, but it seems that if I make the window big enough the dataArea's maxX and maxY stop growing. To reproduce do the following: Start the JFreeChartDemo, display the XY Plot in XY Charts. Maximize the window and select the entire plot area for zoom. Only part of the selected area is displayed after the zoom. My workaround is to use w=zoomRectangle.getWidth() and h=zoomRectangle.getHeight() which works fine (I'm not sure why you're doing the Math.min() to start with), but I'd rather understand why the dataArea stops growing.
Andreas
Interactive zooming problem
Re: Interactive zooming problem
Another workaround that seems to work: in mouseReleased() replace this.info.getDataArea() with this.getScaledDataArea(). Looking at mouseDragged() I assume that's what was intended??
Andreas
Andreas
Re: Interactive zooming problem
Hi Andreas,
Thanks for the feedback. I think you have found a bug, the mouseReleased method should be looking at the scaled dataArea.
I'll try to explain what the scaling is about...
In ChartPanel there are now four properties minimum/maximumDrawWidth and minimum/maximumDrawHeight (the minimum settings exist in 0.8.1 in another form, but the maximum is new). The idea is that when the panel is below the minimum size, rather than let the chart layout start to fall apart (which it does!) the chart is drawn at the minimum size and then scaled down to fit into the smaller space. That bit is already in 0.8.1, and I think it works pretty well.
What I'm trying now is setting a maximum size...for charts larger than the maximum, the charts are drawn at the maximum size then scaled UP to fit into the larger space. This has the effect of magnifying everything including the fonts, which sometimes improves the chart appearance (I think it might be slower though).
The problem with all this scaling is that the dataArea (the area 'inside' the axes) is now bigger or smaller on screen than recorded (in this.info). So I keep track of the scale factors and calculate a scaledDataArea which should match what is on screen. The zoom rectangle needs to be evaluated relative to the scaled area to know where the axes are.
The Math.min(...) looks to me to be redundant, I'll try removing them and see what happens.
Regards,
DG.
P.S. I didn't try out the popup menu on Windows yet, is it working again? It isn't being triggered in 0.8.1. I read somewhere that the popup trigger on Windows occurs in the mouse release event, so I've duplicated the code there.
Thanks for the feedback. I think you have found a bug, the mouseReleased method should be looking at the scaled dataArea.
I'll try to explain what the scaling is about...
In ChartPanel there are now four properties minimum/maximumDrawWidth and minimum/maximumDrawHeight (the minimum settings exist in 0.8.1 in another form, but the maximum is new). The idea is that when the panel is below the minimum size, rather than let the chart layout start to fall apart (which it does!) the chart is drawn at the minimum size and then scaled down to fit into the smaller space. That bit is already in 0.8.1, and I think it works pretty well.
What I'm trying now is setting a maximum size...for charts larger than the maximum, the charts are drawn at the maximum size then scaled UP to fit into the larger space. This has the effect of magnifying everything including the fonts, which sometimes improves the chart appearance (I think it might be slower though).
The problem with all this scaling is that the dataArea (the area 'inside' the axes) is now bigger or smaller on screen than recorded (in this.info). So I keep track of the scale factors and calculate a scaledDataArea which should match what is on screen. The zoom rectangle needs to be evaluated relative to the scaled area to know where the axes are.
The Math.min(...) looks to me to be redundant, I'll try removing them and see what happens.
Regards,
DG.
P.S. I didn't try out the popup menu on Windows yet, is it working again? It isn't being triggered in 0.8.1. I read somewhere that the popup trigger on Windows occurs in the mouse release event, so I've duplicated the code there.
Re: Interactive zooming problem
Hi David,
Thanks for the explanation. The popup menu now works for Windows. Btw: I have made one more chage to the interactive zoom: I've added an option to "draw" the zoom rectangle rather than "fill" it. The filled rectangle seems to produce a lot of flicker with Java 1.4.0 and even if it doesn't I find it a bit ugly (just my personal taste
. I'll check it in soon.
Andreas
Thanks for the explanation. The popup menu now works for Windows. Btw: I have made one more chage to the interactive zoom: I've added an option to "draw" the zoom rectangle rather than "fill" it. The filled rectangle seems to produce a lot of flicker with Java 1.4.0 and even if it doesn't I find it a bit ugly (just my personal taste

Andreas