DataTipRenderer
By Gerben Robijn on Jul 20, 2007 in Actionscript 3, Charting, Flex
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:
-
<?xml version="1.0" encoding="utf-8"?>
-
<mx:TextArea xmlns:mx="http://www.adobe.com/2006/mxml" borderStyle="outset"
-
editable="false" selectable="true" link="linkHandler(event)" fontSize="16">
-
-
<mx:Script>
-
<![CDATA[
-
-
import flash.events.TextEvent;
-
-
public function linkHandler(event:TextEvent):void {
-
// Open the link in a new window.
-
navigateToURL(new URLRequest(event.text), ‘_blank’)
-
}
-
-
override public function set data(value:Object):void
-
{
-
super.data=value;
-
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>";
-
}
-
]]>
-
</mx:Script>
-
</mx:TextArea>






