3 Replies Latest reply on Aug 31, 2009 12:09 AM by msabljic

    Simple chart data tip question

    msabljic Level 1

      Hi,

      If i have a graph with let's say month names on x-axis and some numeric values on y-axis, when over specific chart item tooltip displays both month name and numeric value. How can i achive that tooltip displays only let's say numeric value (y-axis value) and not also month name (x-axis value)?

      Thanks in advance,
      Best regards

        • 1. Re: Simple chart data tip question
          chris.huston.t10 Level 3

          You can use a dataTipFunction to customize the chart data tip.

           

          private function myDataTipFxn(hd:HitData):String {

               var dt:String = "y value = " + hd.item.yourYvalueField;

               return dt;

          }

           

          Chris

          1 person found this helpful
          • 2. Re: Simple chart data tip question
            Andrew Rosewarn Level 3

            Yes as above and as below.  Calling you dataTipFunction from the Chart tag, whatever type of chart it may be.

             

            <?xml version="1.0" encoding="utf-8"?>

            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >

             

                <mx:Script>

                    <![CDATA[

                    import mx.charts.HitData;

            import mx.collections.ArrayCollection;

             

                    [Bindable]

                    private var expensesAC:ArrayCollection = new ArrayCollection( [

                        { Month: "Jan", Profit: 2000, Expenses: 1500, Amount: 450 },

                        { Month: "Feb", Profit: 1000, Expenses: 200, Amount: 600 },

                        { Month: "Mar", Profit: 1500, Expenses: 500, Amount: 300 },

                        { Month: "Apr", Profit: 1800, Expenses: 1200, Amount: 900 },

                        { Month: "May", Profit: 2400, Expenses: 575, Amount: 500 } ]);

             

             

                         private function myDataTipFxn(hd:HitData):String {

                                var dt:String = "Profit = " + hd.item.Profit;

                                return dt;

                           }

                    ]]>

                </mx:Script>

                <mx:LineChart id="linechart" color="0x323232" height="259"

                   showDataTips="true" dataProvider="{expensesAC}"

                   dataTipFunction="myDataTipFxn" x="88.5" y="63">

             

                   <mx:horizontalAxis>

                       <mx:CategoryAxis categoryField="Month"/>

                   </mx:horizontalAxis>

             

                   <mx:series>

                       <mx:LineSeries yField="Profit" form="curve" displayName="Profit"/>

                       <mx:LineSeries yField="Expenses" form="curve" displayName="Expenses"/>

                       <mx:LineSeries yField="Amount" form="curve" displayName="Amount"/>

                   </mx:series>

                </mx:LineChart>

            </mx:Application>

            • 3. Re: Simple chart data tip question
              msabljic Level 1

              Thank you guys for help and examples, very useful.

               

              Best regards