Yes, that "is" syntax was the ticket - thanks, Matt. To paraphrase Bill
Clinton, I now know what the meaning of is is.
I did have to do it slightly differently, to avoid a "no return value"
error - storing the return string in a variable outside the if statement.
Here's how it looks:
private function buildDataTip(e:HitData):String
{
var returnItem:String;
if (e.element is ColumnSeries)
{
var col:ColumnSeries = ColumnSeries(e.element);
returnItem = "<b>"+col.name+":</b><br>"+ e.item[col.yField];
}
else if (e.element is LineSeries)
{
var line:LineSeries = LineSeries(e.element);
returnItem = "<b>"+line.name+":</b><br>"+ e.item[line.yField];
}
return returnItem;
}
- Tom
Matt Horn wrote:
>
> you can check against the series type with e.element; something like:
>
> if (e.element is ColumnSeries) {
> var col:ColumnSeries = ColumnSeries(e.element);
> return "<b>"+col.name+":</b><br>"+ e.item[col.yField];
> } else if (e.element is LineSeries) {
> ...
> }
>
> 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, August 03, 2006 12:00 PM
> > To: [email protected] <mailto:flexcoders%40yahoogroups.com>
> > Subject: [flexcoders] Datatips on Cartesian chart
> >
> > I have a Cartesian chart that contains several column series
> > and a line series.
> >
> > I'm customizing the dataTips for the chart with a simple
> > dataTipFunction:
> >
> > private function buildDataTip(e:HitData):String { var
> > col:ColumnSeries = ColumnSeries(e.element); return
> > "<b>"+col.name+":</b><br>"+ e.item[col.yField]; }
> >
> > This works fine for the columns - but of course not for the line.
> >
> > Within that function, how would I define a separate block of
> > code to use in creating a custom datatip for the line series?
> >
> > - 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/