DataTipRenderer

In charting you can set datatips to true to diplay some information about the point you have selected in a graph. To make a custom tip you have to use the dataTipRenderer property from the graph. It's just like making a renderer for a combobox but the exception is that the data doesn't come from the dataprovider but it comes from the graph it self. So just the x and y value. You can get them through the "chartItem" like: data.chartItem.xValue;

This is an example for a datatiprenderer taken from Kyle

Actionscript:
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:TextArea xmlns:mx="http://www.adobe.com/2006/mxml" borderStyle="outset"
  3.     editable="false" selectable="true" link="linkHandler(event)" fontSize="16">
  4.    
  5.     <mx:Script>
  6.         <![CDATA[
  7.        
  8.         import flash.events.TextEvent;
  9.  
  10.         public function linkHandler(event:TextEvent):void {
  11.             // Open the link in a new window.
  12.             navigateToURL(new URLRequest(event.text), ‘_blank’)
  13.         }
  14.  
  15.         override public function set data(value:Object):void
  16.         {
  17.             super.data=value;
  18.             htmlText="<a href=’event:http://www.google.com/search?hl=en&q=" + data.chartItem.yValue + "+" + data.chartItem.xValue + "&btnG=Google+Search’>" + data.chartItem.yValue + ":" + data.chartItem.xValue + "</a>";
  19.         }
  20.         ]]>
  21.     </mx:Script>
  22. </mx:TextArea>


Post a Comment