Has anyone looked at Yahoo's ASTRA? It's fairly nifty, but I had some issues creating a custom label for a pie chart. They have an example for a line chart, which overrides an axis's series's label renderer. My solution was to override the myPieChart.dataTipFunction
. For data that looks like:
myPieChart.dataProvider =
[ { category: "Groceries", cost: 50 },
{ category: "Transportation", cost: 175} ]
myPieChart.dataField = "cost";
myPieChart.categoryField = "category";
I wrote a function like this:
import com.yahoo.astra.fl.charts.series.*
myPieChart.dataTipFunction =
function (obj:Object, index:int, series:ISeries):String {
return obj.category + "\n$" + obj.cost;
};
There's ceil(2.718281828459045) problems with this:
I'm directly calling the category and cost properties of the data provider. The names are actually configurable when setting up the chart, I'd like to maintain that flexibility.
The default data tip would show the category, the cost (without a dollar sign), and the percentage it makes up in the pie chart. So here, I've lost the percentage. I just have no idea which property of what would hold that. It might be part of the series.
I probably only need to override the
dataItemRenderer
for the cost part of the series, but I don't know how to access it. The documentation is a little ... lacking there.
Normally I would just look at the default implementation of the dataTipFunction
but it's all inside a compiled shm that's part of the components distributed from yahoo.
Can anyone help me complete this overridden function with percentage information and the flexibility mentioned in point 1?