flexcoders  

[flexcoders] Re: Apparent Bug in LineCharts - filterData property Kills Data Tips

g_odds
Wed, 21 Feb 2007 08:53:50 -0800

I noticed this bug several weeks ago and fortunately I managed to find
the problem and create a workaround.

You'll have to have a poke around in the LineSeries source code to
fully understand what I'm saying here. You need to extend the
LineSeries class and extend the findDataPoints function. In the
LineSeries' findDataPoints function the if (!isNaN(v.yFilter) &&
!isNaN(v.xFilter)) condition will fail because when filterData = false
and the filterCache function of the series is called (this happens
when the min or max of an axis is set because the mapping changes) the
.yFilter and xFilter properties will be set to NaN for the points.
That makes sense in it's own way, but the upshot of that is that the
minItem variable is never set and, therefore, an empty array will
always be returned.

So the fix is to copy the code from the LineSeries source code and in
your overriding function change the if (!isNaN(v.yFilter) &&
!isNaN(v.xFilter)) condition to if (!isNaN(v.yNumber) &&
!isNaN(v.xNumber)).  So yes, this is a nasty little hack but I haven't
found any other way to solve the problem.

Hope that helps,

Graham


--- In flexcoders@yahoogroups.com, "thegiffman" <[EMAIL PROTECTED]> wrote:
>
> If I take the standard line chart demo code, and add showDataTips to
> the line chart, they display normally.  Yet, the moment I set
> filterData to false on one of the LineSeries, it kills data tips for
> this series.  I think this is a bug in the charting components, as the
> data tips and the filterData attribute do not conflict for column
> charts.
> 
> 
> 
> 
> <?xml version="1.0"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
>      <mx:Script><![CDATA[
>      import mx.collections.ArrayCollection;
>      [Bindable]
>      public var expenses:ArrayCollection = new ArrayCollection([
>          {Month: "Jan", Profit: 2000, Expenses: 1500, Amount: 450},
>          {Month: "Feb", Profit: 1000, Expenses: 200, Amount: 600},
>          {Month: "Mar", Profit: 1500, Expenses: 500, Amount: 300}
>      ]);
>      ]]></mx:Script>
>      <mx:LineChart id="myChart" dataProvider="{expenses}"
> showDataTips="true">
>          <mx:seriesFilters>
>              <mx:Array/>
>          </mx:seriesFilters>
>          <mx:horizontalAxis>
>              <mx:CategoryAxis dataProvider="{expenses}"
> categoryField="Month"/>
>          </mx:horizontalAxis>
>          <mx:series>
>              <mx:LineSeries yField="Profit" displayName="Profit"
> filterData="false"/>
>              <mx:LineSeries yField="Expenses" displayName="Expenses"/>
>              <mx:LineSeries yField="Amount" displayName="Amount"/>
>          </mx:series>
>      </mx:LineChart>
> </mx:Application>
>