2 Replies Latest reply on Nov 22, 2010 9:35 AM by Tanu Jain

    Call back function for dataTips


      I'm trying to develop sample applications using SAP as the backend system, so I'm limited to Flex 3.


      I'm trying to build a Plot Chart that simply plots the Cost and Expense of a project. I'm passing in an array of 10 - 20 projects with Project Name, Cost, and Expense.


      I'm able to display the all points just fine, but I can't get the dataTips to display the name of the project. I was told I had to use some sort of callback function using HitData class.


      Can someone shed some light on this?




        • 1. Re: Call back function for dataTips
          rob_phelan Level 1

          I'll include some code to help clarify....





          public var dataSource:ArrayCollection;




          public var prjcost:String;




          public var prjbenefit:String;




          public var prjname:String;






          <mx:PlotChart id="plotchart1" dataProvider="{dataSource}" showDataTips="true" >




              <mx:PlotSeries yField="{prjcost}" xField="{prjbenefit}"/>










          If i add displayName="{prjname}" to the PlotSeries, i do not get the text value - only the name of the attribute I'm passing in.

          • 2. Re: Call back function for dataTips
            Tanu Jain

            In mxml,

            <mx:PlotChart dataTipFunction="myDatatipFunction">


            private function myDataTipFunction(hitData:HitData):String
                            return  "<b>" +
                                + "\nBenefit: " + hitData.item.prjbenefit
                                + "\nCost: " + hitData.item.prjcost ;            


            Hopefully ur dataSource is a collection of prjname,prjbenefit and prjCost.