PDA

View Full Version : Retrieve pieChart.nameField value in dataTip function


tsj4
11-06-2008, 11:08 PM
I need the pieChartSeries.nameField value to be added in my custom datatip.

this value is included in the hitData.item object just do not know how to reference it.

I do know I could just reference that object from the dataProvider but the key changes based on what the response is.


var p1:PieSeries = new PieSeries();
p1.dataProvider = traffic;
p1.field = measure1[mes_id];

p1.nameField=initLabel

p1.name = measure1[mes_label];
p1.displayName = measure1[mes_label];
p1.setStyle("labelPosition", "callout");
p1.filters = [];
var pSeries : Array = new Array();
pSeries.push(p3);
p.series = pSeries;
p.dataProvider = ac;


when I use this the value I am attempting to target is included in the object


PieSeriesItem(h.chartItem).item

tsj4
11-07-2008, 12:22 AM
well I had to use an alternative since I spent way to much time of this.


private function pieDataTipFunc(h:HitData) :String
{
var title:String;

if (initLabel == "company_name"){
title = h.item.company_name
} else if (initLabel == "domain_name"){
title = h.item.domain_name
} else if (initLabel == "infohash"){
title = h.item.infohash
} else if (initLabel == "file_size"){
title = h.item.file_size
} else if (initLabel == "mime_type"){
title = h.item.mime_type
} else if (initLabel == "ip"){
title = h.item.ip
} else if (initLabel == "country"){
title = h.item.country
} else if (initLabel == "region"){
title = h.item.region
} else if (initLabel == "asn"){
title = h.item.asn
} else if (initLabel == "isp"){
title = h.item.isp
}

for (var i:Number = 0;i<totalMeasureLabels.length;i++){
if (h.element.name == totalMeasureLabels[i]) {
return "<b>"+title+"</b>\n" +h.element.name +" : "+formatToLargest(Number(PieSeriesItem(h.chartItem) .value), 2)
}
}

if (h.element.name == "Downloads Completed" ||h.element.name == "Downloads Initiated" ) {
return "<b>"+title+"</b>\n" +h.element.name +" : "+numberFormatter.format(Number(PieSeriesItem(h.cha rtItem).value))
}

if (h.element.name == "Total Offload") {
return "<b>"+title+"</b>\n" +h.element.name +" : "+decimalToPercentage(Number(PieSeriesItem(h.chartI tem).value))
}

return h.item.name;
}