Chart single Click event : Column Chart Event « Chart « Flex






Chart single Click event

Chart single Click event
           

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script>
     import mx.collections.ArrayCollection;
     import mx.charts.events.ChartEvent;
     import mx.controls.Alert;

     [Bindable]
     public var myArray:ArrayCollection = new ArrayCollection([
        {Country:"A", GDP:11},
        {Country:"B", GDP:22},
        {Country:"C", GDP:33},
        {Country:"D", GDP:44}
     ]);
     [Bindable]
     public var myArray2:ArrayCollection = new ArrayCollection([
        {Country:"A", GDP:33},
        {Country:"B", GDP:22},
        {Country:"C", GDP:11},
        {Country:"D", GDP:44}
     ]);
     private function chartEventHandler(event:ChartEvent):void {
        Alert.show("Event of type: " +event.type,"ChartEvent",Alert.OK);
    }

</mx:Script>
  <mx:Panel title="Column Chart">
     <mx:ColumnChart id="myChart" dataProvider="{myArray}" showDataTips="true"
         chartClick="chartEventHandler(event)">
        <mx:horizontalAxis>
           <mx:CategoryAxis categoryField="Country"/>
        </mx:horizontalAxis>
        <mx:series>
           <mx:ColumnSeries dataProvider="{myArray}" yField="GDP" xField="Country" displayName="Array" />
           <mx:ColumnSeries dataProvider="{myArray2}" yField="GDP" xField="Country" displayName="Array2" />
        </mx:series>
     </mx:ColumnChart>
     <mx:Legend dataProvider="{myChart}"/>
  </mx:Panel>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Column Chart Item click EventColumn Chart Item click Event
2.Column Chart Item double click EventColumn Chart Item double click Event
3.Column Chart Item mouse down EventColumn Chart Item mouse down Event
4.Column Chart Item mouse move EventColumn Chart Item mouse move Event
5.Column Chart Item mouse up EventColumn Chart Item mouse up Event
6.Column Chart Item roll out EventColumn Chart Item roll out Event
7.Column Chart Item roll over EventColumn Chart Item roll over Event
8.Chart double click eventChart double click event