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

    Call back function for dataTips

    rob_phelan

      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?

       

      thanks,

      robert.

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

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

           

          [

          Bindable]

           

          public var dataSource:ArrayCollection;

          [

          Bindable]

           

          public var prjcost:String;

          [

          Bindable]

           

          public var prjbenefit:String;

          [

          Bindable]

           

          public var prjname:String;

           

           

           

           

           

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

            <mx:series>

           

           

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

           

           

            </mx:series>

           

           

          </mx:PlotChart>

           

           

           

          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>" +
            hitData.item.prjname                   
                                + "\nBenefit: " + hitData.item.prjbenefit
                                + "\nCost: " + hitData.item.prjcost ;            
                        }

             

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