1 Reply Latest reply on Jan 3, 2007 5:36 AM by chris.huston.t10

    Clickable Chart

    Kasem_Abotel
      I have Pie Chart, and I want it to be Clickable, I use the click event

      click="onClick(event)"

      the problem with this it does not give me access to the HitData

      for example if I want toop tip function, I can do the following

      private function formatDataTip(hitData:HitData):String
      {
      // here I have access to hit data
      }

      using dataTipFunction="formatDataTip"

      how Can I access the Hit Data when the user click'

      Thanks

      Kasem

        • 1. Re: Clickable Chart
          chris.huston.t10 Level 3
          Here is an example that will get the HitData from a click on a pie chart:

          <mx:PieChart dataProvider="{pieData}" itemClick="chart_click(event)">
          <mx:series>
          <mx:PieSeries field="Orders" nameField="Flavor" labelPosition="callout"/>
          </mx:series>
          </mx:PieChart>

          import mx.collections.ArrayCollection;
          [Bindable]
          public var pieData:ArrayCollection = new ArrayCollection([
          {Flavor: "Apple", Orders: 100},
          {Flavor: "Banana", Orders: 200},
          {Flavor: "Lemon", Orders: 300} ]);
          import mx.charts.events.ChartItemEvent;
          import mx.charts.HitData;
          public function chart_click(evt:ChartItemEvent):void {
          trace(evt.hitData.item.Flavor);
          trace(evt.hitData.item.Orders);
          }

          Vygo