Zooming in on Plot

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Linda Rawson

Zooming in on Plot

Post by Linda Rawson » Thu Nov 30, 2000 11:35 pm

I need the ability to drag the mouse and draw a rectangle and then repaint the time series graph. I do not mind writing this if I even had a clue where to start. There is a lot of programs and I think it belongs in the JFreeChartPanel but am not sure where to add the Mouse Listeners and then what to call to repaint.

Linda

David Gilbert

RE: Zooming in on Plot

Post by David Gilbert » Fri Dec 01, 2000 8:40 pm

Hi Linda,

JFreeChartPanel is the right place to start. Once you have some code that lets the user select a rectangle, you need to work out how that rectangle relates to the plot area. Unfortunately, the plot area changes in size depending on the title font, the axis labels etc. So the JFreeChart object would need changing also to record the plot area every time the chart is redrawn.

Once you can compare the user selected area and the plot area, you can adjust the min and max values on the axes accordingly. The only other thing is an easy way to zoom out again.

I encourage you to have a go at this change and post your code for others to see. Right now, I have limited time because I've started a new job...but as soon as I find some time I'll have a go at implementing a zoom feature, unless you (or someone else) gets it done first.

Regards,

DG.

Linda Rawson

RE: Zooming in on Plot

Post by Linda Rawson » Mon Dec 04, 2000 4:11 am

DG,

I will have a go at it. There is a guy that does this in his code. It is really old code and I am still trying to decipher not just his code but the whole java thing.

http://www.sci.usq.edu.au/staff/leighb/graph/

If this helps you or somebody else do this zoom in enhancement sooner than me, the novice, then so be it. I am an Oracle programmer by trade but am connecting the oracle database to a custom written java application in a crash course!

Thanks for everything! I really appreciate your product and I wish you continued success in your new job.

Linda

Locked