11 Replies Latest reply on Nov 13, 2006 5:01 AM by David_S_deB

    dataTipFunction and ChartItemEvent bug?

    Jim the Knife Level 1

      I pulled the sample that follows from the Help file because of a problem I'm having putting data tips on my chart. I upgraded to the full version of Flex 2 from Beta 3, and my chart data tips stopped working. I redid them following the example from Help, but kept getting the following error when I move the mouse over the chart item: TypeError: Error #1034: Type Coercion failed: cannot convert mx.charts::HitData@3557fc1 to mx.charts.events.ChartItemEvent. I get the same error when I run the sample below (which had a couple of errors in it already that I fixed).

      So two questions: 1) is this a bug? and 2) how can I work around this?

      Thanks, Jim

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      import mx.charts.events.ChartItemEvent;
      import mx.collections.ArrayCollection;

      public var expenses:ArrayCollection = new ArrayCollection([
      {Expense: "Taxes", Amount: 2000},
      {Expense: "Gas", Amount: 100},
      {Expense: "Food", Amount: 200}

      public function dtFunc(e:ChartItemEvent):String {
      return e.hitData.item.Expense + ": <B>$" + e.hitData.item.Amount + "</B>";
      <mx:BarChart dataProvider="{expenses}" showDataTips="true" dataTipFunction="dtFunc">
      <mx:CategoryAxis dataProvider="{expenses}" categoryField="Expense" id="Expense"/>
      <mx:LinearAxis id="Amount"/>
      <mx:BarSeries xField="Amount" yField="Expense"/>