Menu

#241 Panning of charts

open
None
7
2009-03-17
2009-03-13
Boente
No

The attached files enable the JFreeCharts to be panned. They must implement the Pannable interface. An example implementation have been added for the XYPlot.

To enable the panning just call
<code>
PannableChartPanel chartPanel = ....
chartPanel.setMouseMode(PannableChartPanel .MOUSE_PAN);
</code>
and use the PannableXYPlot.

Someone might find some nice mouse gestures to use the panning.

I would be happy if this is integrated to JFreeChart.

Discussion

  • Boente

    Boente - 2009-03-13

    Patch for panning a XYPlot

     
  • David Gilbert

    David Gilbert - 2009-03-17

    Thanks, I'll take a look.

     
  • David Gilbert

    David Gilbert - 2009-03-17
    • priority: 5 --> 7
    • assigned_to: nobody --> mungady
     
  • David Gilbert

    David Gilbert - 2009-03-17

    Right, I've taken a look and I think this is very promising. There are a few things we need to work on:

    (1) Mouse wheel event support was new in Java 1.4, and JFreeChart is still advertised as supporting Java 1.3 or later. Options to get around this: (i) drop 1.3 support; (ii) find a way to implement mouse wheel support as an option that fails gracefully when the runtime is 1.3;

    (2) I'd prefer the panning to be invoked with a modifier key (e.g. CTRL-mouse drag) rather than specifying a mode via the setMouseMode() method. Then we can have both zooming and panning behaviour triggered by mouse drags.

    (3) It might make sense to allow bounds to be specified on the zooming and panning - i.e. not let the user pan too far away from the actual data values, or zoom too far in or out.

    (4) For consistency, it might be a good idea to specify the panRange in the Pannable interface as a percentage value of the current axis length (that's the way the Zoomable interface methods are specified).

     
  • Boente

    Boente - 2009-03-18

    Demo added; panning by percentage axis length added

     
  • Boente

    Boente - 2009-03-18

    ad 4): Implementation is very easy. I have uploaded a new patch including a demo application for the panning.

    ad 1): I am a big supporter of dropping 1.3 support
    ad 2): The setMouseMode() variant is a hack. I would prefer if one can select between different invocation schemes. But the CTRL-mouse drag is ok for now.
    ad 3): Yeah. I aggree. We should think about to get the ranges from the datasets automatically (as default) and if the programmer likes, the default settings should be overwritable.

     
  • Boente

    Boente - 2009-03-18

    Added Ctrl-Modifier to start with panning

     
  • Boente

    Boente - 2009-03-18

    ad 2): The pan_patch3.zip patch added the functionality to start panning with the CTRL-modifier.

    ad 1): The mouse wheel support is only necessary for zooming. It can be dropped without influencing the pan support, which should be added by this path track.

    Ok, only the ranges are missing... We are getting forward :-)

     
  • David Gilbert

    David Gilbert - 2009-03-18

    Thanks. Today I already committed mouse wheel support (it uses reflection to register the MouseWheelListener, and should fail gracefully under JRE 1.3.1) then worked on the panning code. I've got some code (that's based on your first patch, but modified a fair amount) that I want to check over one more time then I'll commit it to Subversion (probably tomorrow morning). Then it would be great if we could both give it another review---checking that it covers everything that you have in your patch---and some further testing before the 1.0.13 release (which I want to make by the end of the month).

     
  • David Gilbert

    David Gilbert - 2009-03-18

    Oh, I also didn't cover the restricted ranges thing yet either. I think it can probably wait (and it needs to work for both zooming and panning as well).

     

Log in to post a comment.