PDA

View Full Version : Graph Rollover Information box


Paul_Cottie
09-24-2007, 10:40 AM
Hi,

I am a novice at the whole graphing in Flex thing and I was just wondering how I could change the details that go into the rollover information box when you rollover a datapoint in a graph.

I have attached an image of part of a graph I have made showing the information box I mean. I would like to have some different information than the xField and yField properties.

Does anybody know of any tutorials that would be helpful for this?

thanks

drkstr
09-24-2007, 03:02 PM
Here is how I did it in a project a while back.


<mx:PieChart id="chart" height="100%" width="100%"
paddingRight="5" paddingLeft="5"
showDataTips="true" dataProvider="{myChartData}"
dataTipFunction="displayPieDataTip" >

<!-- .... -->

</mx:PieChart>



private function displayPieDataTip( hitData:HitData ):String {
var title:String = 'Oops!';
var diggs:String = '0';

for each ( var story:Object in myStoryData ) {
if ( story.id == hitData.item.StoryID ) {
title = story.title;
diggs = story.diggs.toString();
break;
}
}

return title+"\n"+"Diggs: "+diggs;
}


The dataTipFunction property points to a function which takes a HitData object as a parameter and returns a formatted string. You can find the full example here: http://labs.splashlabs.com/diggcharts/srcview/index.html


Best Regards,
...aaron

Paul_Cottie
09-24-2007, 04:32 PM
Thanks Very Much!!