1 Reply Latest reply on Jul 6, 2009 2:05 AM by Richard_Abbott

    Zoom feature in Charts

    KalavatiSingh Level 1

      Hi ,

           I wanted zooming feature applied to my graphs.I used Panzoom  but i find  a lot of errors  with it.Kindly let me know if anyone has used PanZoom or  alternatively  suggest some good examples for the same.




      Kalavati  Singh


        • 1. Re: Zoom feature in Charts
          Richard_Abbott Level 3


          I have just been implementing the same kind of thing and it is easy to do just with the built-in charts in Flex Professional.

          There are five stages:

          1) Add a data canvas to the chart, eg

                          data_canvas = new CartesianDataCanvas();

          2) Add some kind of display device (like another canvas with transparency say 0.5) to show users what area will be zoomed and add this as a child to the chart.

          3) Catch the mouse down/move/up events to get the size of the item in (2) correct.

          4) On mouse up use the data canvas localToData() method to turn your user's mouse coordinates into data values.

          5) Use the data values from (4) to adjust the min/max of the axes.


          There used to be a localToData method on the chart itself but this is now deprecated, hence the need for the data canvas. You'll find a few places where you need to cast values, and you have to be careful with the left and bottom "gutter" areas of the chart, and you should give your users a way to get back to full-size, but these bits are easily added once you have the basic mechanism.