Adobe Flex 3 Help

Disabling interactivity

You can make the series in a chart ignore all mouse events by setting the interactive property to false for that series. The default value is true. This lets you disable mouse interactions for one series while allowing it for another.

The following example disables interactivity for events on the first and third PlotSeries objects:

<?xml version="1.0"?>
<!-- charts/DisableInteractivity.mxml -->
<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:"January", Profit:2000, Expenses:1500, Amount:450},
        {Month:"February", Profit:1000, Expenses:200, Amount:600},
        {Month:"March", Profit:1500, Expenses:500, Amount:300},
        {Month:"April", Profit:500, Expenses:300, Amount:500},
        {Month:"May", Profit:1000, Expenses:450, Amount:250},
        {Month:"June", Profit:2000, Expenses:500, Amount:700}
     ]);

  ]]></mx:Script>
  <mx:Panel title="Disable Interactivity">
     <mx:PlotChart id="myChart" 
        dataProvider="{expenses}" 
        showDataTips="true"
     >
        <mx:series>
           <mx:PlotSeries 
                xField="Expenses" 
                yField="Profit"
                displayName="P 1" 
                interactive="false"
           />
           <mx:PlotSeries 
                xField="Amount" 
                yField="Expenses"
                displayName="P 2"
           />
           <mx:PlotSeries 
                xField="Profit" 
                yField="Amount" 
                displayName="P 3" 
                interactive="false"
           />
        </mx:series>
     </mx:PlotChart>
     <mx:Legend dataProvider="{myChart}"/>
  </mx:Panel>
</mx:Application>

The executing SWF file for the previous example is shown below:

Disabling the series interactivity has the following results:

  • The series does not show DataTip controls.
  • The series does not generate a hitData structure on any chart data event.
  • The series does not return a hitData structure when you call the findDataPoints() method on the chart.