Tommyke
Tommyke

Reputation: 37

Flex mobile: Zoom and scroll in bar chart

I'm making a mobile application with a bargraphs in it. I'm using Flash Builder 4.6 and Flex SDK 4.6.0.

In my appication I'm using the builtin Bar Graph from Flash Builder. Is there a possibility to zoom and scroll with this chart. Remembder that it is a mobile app (iPad) so it needs to work with gestures.

Upvotes: 0

Views: 1549

Answers (2)

andrewdudek84
andrewdudek84

Reputation: 181

Add the chart in a Group and add gestureZoom on the Group.

private function onGestureZoom(event:TransformGestureEvent):void{
    if(canvas.scaleY.valueOf() >= 1)
    {
        canvas.scaleX *= event.scaleX;
        canvas.scaleY *= event.scaleY;
    }else
    {
        canvas.scaleX = 1;
        canvas.scaleY = 1;
    }
}

<s:Group id="canvas"  gestureZoom="onGestureZoom(event)" width="100%" height="100%">
   <!-- chart (set width and height to 100%)-->
</s:Group>

Upvotes: 1

AlBirdie
AlBirdie

Reputation: 2071

First and sixth result on google for flex chart zoom.

This does not show how to work with gestures in this case, but I haven't seen any charting engines for flex mobile that do, so you'd have to write your own I'm afraid. But I don't see any reason why scrolling wouldn't work. Not sure about the pinch zoom though. Don't expect butter smooth performance from the MX charts, though. On a mobile with large data sets they are slow as hell.

Upvotes: 0

Related Questions