datatipfunction in a linechart
To customize the datatip in a linechart in flex you need to use the datatipfunction property that refers to a function. This function must return a string and take a parameter of type HitData. To get the current VALUE of the line point you're mousing over you need to use LineSeriesItem(hitData.chartItem).yValue - I found this difficult to find out at first.
Here's an example:
Here's an example:
private function lcDataTipFunction(hitData:HitData):String
{
var s:String;
s = LineSeries(hitData.element).displayName + "\n";
s += LineSeriesItem(hitData.chartItem).yValue + "\n";
s += hitData.item.Day + " at " + hitData.item.Time;
return s;
}
Comments
nice portfolio site as well.
Thanks
Thank you for your very nice code about datatipfunction in linechart and friendly you are very cute.
BR
Farid Valipour
Canadians rule!
Just to add, following imports are needed
import mx.charts.HitData;
import mx.charts.series.items.LineSeriesItem;
Also to note, dataTipFunction is declared under the Chart, not the line series.
- James S