use the hitData object of the ChartItemEvent class

sample is as follows :


<?xml version="1.0"?>
<!-- Simple example to demonstrate the PieChart control. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute">

   <mx:Script>
       <![CDATA[
       import mx.controls.Alert;
       import mx.collections.ArrayCollection;
       import mx.charts.events.ChartItemEvent;
       [Bindable]
       private var medalsAC:ArrayCollection = new ArrayCollection( [
           { Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
           { Country: "China", Gold: 32, Silver:17, Bronze: 14 },
           { Country: "Russia", Gold: 27, Silver:27, Bronze: 38 } ]);

       private function displayGold(data:Object, field:String,
index:Number, percentValue:Number):String {
           var temp:String= (" " + percentValue).substr(0,6);
           return data.Country + ": " + '\n' + "Total Gold: " + data.Gold +
'\n' + temp + "%";
       }
       private function rollOverp(evt:ChartItemEvent){
           dg.selectedIndex =evt.hitData.chartItem.index
       }
       ]]>
   </mx:Script>

       <mx:PieChart id="chart" height="334" width="374"
           showDataTips="true" dataProvider="{medalsAC}"  x="21" y="10"
themeColor="#804000"   itemRollOver="rollOverp(event)" >
           <mx:series>
               <mx:PieSeries labelPosition="callout" field="Gold"
labelFunction="displayGold"/>
           </mx:series>
       </mx:PieChart>
       <mx:DataGrid  id ="dg" dataProvider="{medalsAC}" x="441" y="323"/>
</mx:Application>

Regards
PS ε

On 5/26/07, Sandeep Malik <[EMAIL PROTECTED]> wrote:

  Guys,

We are having a data grid and a pie chart which show the same data.
What we want is when user does a "mouse over" (or "item roll over")
over a wedge in pie chart, then the corresponding row in data grid
should also show a itemRollOver color and vice versa.

Any suggestions will be appreciated.

Regards,
Sandeep

Reply via email to