Pan/Scroll

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
rnbrooks
Posts: 2
Joined: Wed Jan 05, 2005 4:35 pm
Location: USA
Contact:

Pan/Scroll

Post by rnbrooks » Tue Mar 08, 2005 2:21 pm

I have seen a lot of comments on panning and scrolling a category dataset chart. There is mention of panning working but I have not found any code samples.

Basically, I want to move the mouse on a gantt chart and slide the right or left bounds as if the chart is a 'window' into the dataset. I have studied David Gilbert's guide but no examples of this.

Thx.
RB

Alexander
Posts: 24
Joined: Thu Feb 17, 2005 3:59 pm

Post by Alexander » Tue Mar 08, 2005 3:35 pm

Hi,

In an older release there was an example of panning a XY chart. That example doesn't work with the 1.0.0rc, but the way it works is simple. And I think it can also be used on the gantt chart you want.

What the example does is add a mouselistener and a mousemotionlistener to the chart panel. Using the mousePressed and mouseDragged the movement can be extracted (endPoint - startPoint).

That data can be used to calculate the new upper and lower bounds of the axis.

Addind scrollbars requires some more calculations. A zoom factor for the axis etc.

This is the demo: http://cvs.sourceforge.net/viewcvs.py/j ... 0&view=log

Might be usefull to take a look at.

Alexander

mariuspepu
Posts: 5
Joined: Thu Mar 13, 2008 8:34 am

Post by mariuspepu » Tue Mar 18, 2008 4:51 pm

Hi,

I have the same problem, just that i want to pan over the Y axis.. so to scroll down/up to hidden tasks. Are there any solutions for this?

Thanks!

Locked