Hi, 

I am attempting to create a LineChart where a user can select an area
of the chart to "zoom in" on that area of the chart.

To accomplish this I am setting the minimum and maximum values on the
horizontal/vertical axes representing the area the user selected.  I
am also using interpolateValues to connect the dots so there is a
continuous line for the series.

This works for the most part, but the problem is this:  When certain
points are removed, the resulting line considers only the points
within the specified range and not the entire series when plotting the
line. 

For example, given the following set of points:
{(1, 1000),(2, 2000),(3, 1000),(4, 2000),(5, 1000) }

This would be a line which zig zags between 1000 and 2000.

Now, if you reduce the maximum for the vertical axis to 1999, the
series is plotted as a straight line at 1000.  One would expect a
chart of this data would be the same zig zag form with the tops
removed, not a straight line.

The code below illustrates what i am trying to describe.

Is there a simple solution for this that I am missing?  Or do I have
to create my own LineRenderer?

Any direction is appreciated.

Thanks,
Andy


<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
    <mx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
   
            [Bindable]
            private var ac:ArrayCollection = new ArrayCollection( [
                { x: 1, a: 1000, b: 100 },
                { x: 2, a: 2000, b: 1100},
                { x: 3, a: 1000, b: 100 },
                { x: 4, a: 2000, b: 1100},
                { x: 5, a: 1000, b: 100 }]);
               
        ]]>
    </mx:Script>
   
    <mx:VBox>
        <mx:HBox>
            <mx:Label text="verticalAxis minimum" />
            <mx:NumericStepper id="vmin" value="0"
maximum="{vmax.value}" stepSize="10"/> 
        </mx:HBox>
        <mx:HBox>
            <mx:Label text="verticalAxis maximum" />
            <mx:NumericStepper id="vmax" value="2000"
minimum="{vmin.value}" maximum="2500" stepSize="10" /> 
        </mx:HBox>
    </mx:VBox>

    <mx:Panel height="100%" width="100%">
       
        <mx:LineChart id="linechart" height="100%" width="100%"
dataProvider="{ac}">
               
            <mx:horizontalAxis>
                <mx:LinearAxis baseAtZero="false" />
            </mx:horizontalAxis>
            <mx:verticalAxis>
                <mx:LinearAxis baseAtZero="false"
minimum="{vmin.value}" maximum="{vmax.value}" />
            </mx:verticalAxis>

            <mx:series>
                <mx:LineSeries yField="a" displayName="a"
interpolateValues="true" />
                <mx:LineSeries yField="b" displayName="b"
interpolateValues="true" />
            </mx:series>
        </mx:LineChart>
       
    </mx:Panel>

</mx:Application>

Reply via email to