I was starting to think along the same lines, but I was hoping there was
more direct access to the percent value.
Trying this your code, it does work - but only if I have labelPosition
set to a value besides "none".
The problem is, I don't want to display labels!
- Tom
Matt Horn wrote:
>
> how about using the label function to populate an associative array and
> then using that value in your data tip:
>
> import mx.charts.HitData;
> import mx.formatters.*;
>
> public var a:Array = new Array();
>
> private function buildDataTip(e:HitData):String {
> var pieName:String = e.item[pie.nameField];
> var pieValue:Number = e.item[pie.field];
> var piePercent:String = a[e.item.Expense];
> var s:String = pieName + ":" + pieValue + ":" +
> piePercent;
> return s;
> }
>
> public function buildLabel(data:Object, field:String,
> index:Number, percentValue:Number):String {
> a[data.Expense] = percentValue;
> return data.Expense + ": $" + data.Amount + "\n" +
> percentValue + "%";
> }
>
> hth,
>
> matt horn
> flex docs
>
> > -----Original Message-----
> > From: [email protected] <mailto:flexcoders%40yahoogroups.com>
> > [mailto:[email protected]
> <mailto:flexcoders%40yahoogroups.com>] On Behalf Of Tom Fitzpatrick
> > Sent: Thursday, July 27, 2006 4:11 PM
> > To: [email protected] <mailto:flexcoders%40yahoogroups.com>
> > Subject: [flexcoders] Custom datatip for pie chart
> >
> > I'm building a custom datatip for a pie chart.
> >
> > How do I get to the percent values for the pie wedges? (In
> > the labelFunction this is expressed as percentValue.)
> >
> > Here's how I'm getting to other values so far:
> >
> > private function buildDataTip(e:HitData) : String { var
> > pie:PieSeries = PieSeries(e.element); var pieName:String =
> > e.item[pie.nameField]; var pieValue:Number =
> > e.item[pie.field]; var piePercent = ?????????
> > .....
> > return .....
> > }
> >
> > - Tom
> >
> >
> >
> >
> >
>
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/