dragging data in a linechart

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

dragging data in a linechart

Post by Hostos Monegro » Wed Oct 23, 2002 4:41 am

Hi,

What I'm trying to do is drag a line (data points) from a line chart using the mouse, then redraw it where I release the mouse. Can someone please suggest a method of doing this or tell me of some other way of moving a line (data points) from a line chart using the mouse. I'm open for any ideas......


thanks,
HM

Dave Gilbert

Re: dragging data in a linechart

Post by Dave Gilbert » Wed Oct 23, 2002 9:00 am

This isn't supported in JFreeChart at present, so you will have to do some coding to get it to work. In the ChartPanel class, there is a getEntityForPoint(...) method that might be of some help, although only the data points are considered entities at present (you could add lines if you wanted to).

I have to say though, JFreeChart (for me anyway) is a data presentation tool rather than a data manipulation tool. So when it comes to adding new features, my focus will be on the presentation side of things...

Regards,

DG

Hostos Monegro

Re: dragging data in a linechart

Post by Hostos Monegro » Wed Oct 23, 2002 2:39 pm

Thanks for replying so quickly. Well, what if I decided not to drag the line, instead I will click the line on some data point, then click on some other location on the chart, and have the chart redraw itself accordlying.



thanks,
HM

Dave Gilbert

Re: dragging data in a linechart

Post by Dave Gilbert » Wed Oct 23, 2002 10:52 pm

A 'click-move-click' sequence isn't really that different to a 'mouseDown-move-mouseUp' sequence.

Certainly it would be possible to extend the current chart mouse events mechanism to add a mouse drag notification. You could have it notify an arbitrary listener that a particular chart entity was dragged from point A to point B. In response, you could update the dataset and redraw the chart. It would involve some modification to the code, but I'm pretty sure it could be done.

Regards,

DG.

Hostos Monegro

Re: dragging data in a linechart

Post by Hostos Monegro » Thu Oct 24, 2002 1:29 am

The problem exists when I try to recompile it from source. Oh, and this isn't a critical issue for me so please don't go out of your way to try and figure it out. Thanks again, I appreciate it..........



thanks,
Hostos

Locked