mavdzee,
That example didn't get updated when the charting API changed. Now, the
localToData and dataToLocal methods are on the series class, rather than
the chart. So you can do something like this now:
var d:Array = series1.localToData(p);
rather than
var d:Array = myChart.localToData(p);
hth,
-matt horn
flex docs
> -----Original Message-----
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of mavdzee
> Sent: Tuesday, April 08, 2008 8:47 AM
> To: [email protected]
> Subject: [flexcoders] deprecated method
> ColumnChart.localToData() used in Flex 3 manual
>
> Hi,
>
> I noticed that one of the examples in the "Advanced Data
> Visualisation Developers Guide" (on page 218/219) uses a
> deprecated method. I get the following warning:
>
> 3606: 'dataToLocal' has been deprecated. Please use
> 'IChartElement2.dataToLocal()'
>
> I copy pasted the example below.
>
> Does anybody know how I can implement the same behavior as in
> the example using non-deprecated methods?
>
> Cheers,
> Andrej
>
> <?xml version="1.0"?>
> <!-- charts/LocalToData.mxml -->
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
> <http://www.adobe.com/2006/mxml> "> <mx:Script><![CDATA[
> import mx.collections.ArrayCollection; public var p:Point;
> [Bindable] public var expenses:ArrayCollection = new
> ArrayCollection([ {Month:"Jan", Profit:2000, Expenses:1500},
> {Month:"Feb", Profit:1000, Expenses:200}, {Month:"Mar",
> Profit:1500, Expenses:500} ]); private function
> updateDetails(e:MouseEvent):void { p = new
> Point(myChart.mouseX,myChart.mouseY);
> mpos.text = "(" + p.x + "," + p.y + ")"; var d:Array =
> myChart.localToData(p); dval.text = "(" + d[0] + "," +
> Math.floor(d[1]) + ")"; p = myChart.dataToLocal(d[0],d[1]);
> dpos.text ="(" + Math.floor(p.x) + "," +
> Math.floor(p.y) + ")";
> }
> ]]></mx:Script>
> <mx:Panel title="Column Chart">
> <mx:ColumnChart id="myChart"
> dataProvider="{expenses}"
> mouseMove="updateDetails(event)"
> showDataTips="true"
> >
> <mx:horizontalAxis>
> <mx:CategoryAxis
> dataProvider="{expenses}"
> categoryField="Month"
> />
> </mx:horizontalAxis>
> <mx:series>
> <mx:ColumnSeries
> xField="Month"
> yField="Profit"
> displayName="Profit"
> />
> <mx:ColumnSeries
> xField="Month"
> yField="Expenses"
> displayName="Expenses"
> />
> </mx:series>
> </mx:ColumnChart>
> <mx:Legend dataProvider="{myChart}"/>
> </mx:Panel>
> <mx:Form width="300">
> <mx:FormItem label="Mouse Position:">
> <mx:Label id="mpos"/>
> </mx:FormItem>
> <mx:FormItem label="Data Position:">
> <mx:Label id="dpos"/>
> </mx:FormItem>
> <mx:FormItem label="DATA:">
> <mx:Label id="dval"/>
> </mx:FormItem>
> </mx:Form>
> </mx:Application>
>
>
>
>
>