[flexcoders] Charting - setting yField property for a PlotSeries when dataProvider is XML

2008-06-27 Thread wreedijk
I am trying to create a PlotChart with series (y is constant) from an
XML object that is defined as follows:

series yVal='Weight'
  dataPoint date='12/01/2004'/ 
  dataPoint date='12/25/2004'/
  dataPoint date='1/1/2005'/
  dataPoint date='1/22/2005'/
/series

I want the xField to be derived from the date attribute in the
dataPoint - no problem. I want the yField to be based on the yVal
attribute in the series (parent of the dataPoints) element. How can I
do this?

mx:PlotSeries 
  dataProvider={weightSeries.dataPoint} 
  xField=@date 
  yField=   ?? What do I put here ?? 
/
There must be a way. Please help! Thanks

THE FOLLOWING WORKS but I don't want to have to repeat the y value in
every data point.

series
  dataPoint date='12/01/2004' yVal='Weight'/ 
  dataPoint date='12/25/2004' yVal='Weight'/
  dataPoint date='1/1/2005' yVal='Weight'/
  dataPoint date='1/22/2005' yVal='Weight'/
/series

mx:PlotSeries 
  dataProvider={weightSeries.dataPoint} 
  xField=@date 
  yField=@yVal
/




[flexcoders] Re: Charting - setting yField property for a PlotSeries when dataProvider is XML

2008-06-27 Thread wreedijk
Thanks Jeff for responding.

Yes, the yField does not exist in the dataProvider itself but it does in
the parent of the dataProvider. Is there no way to reference this? or
can the dataProvider be specified in a different way? Is there a way to
set the value to a constant in the mx:PlotSeries tag?

What do you mean by: ...add theyVal attribute to each item. ?

One thing I CAN do is to convert the series into an ArrayCollection. I
was just hoping to find a more elegant solution to the problem.

--- In flexcoders@yahoogroups.com, Battershall, Jeff
[EMAIL PROTECTED] wrote:

 I'm not sure how you're going to stipulate a yField that doesn't exist
 in the dataprovider.

 If you have control over the XML format, add the additional attribute
to
 each datapoint item.

 If you don't, then you'll need to take what you're given and add the
 yVal attribute to each item.

 Jeff

 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On
 Behalf Of wreedijk
 Sent: Friday, June 27, 2008 2:36 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Charting - setting yField property for a
 PlotSeries when dataProvider is XML


 I am trying to create a PlotChart with series (y is constant) from an
 XML object that is defined as follows:

 series yVal='Weight'
   dataPoint date='12/01/2004'/
   dataPoint date='12/25/2004'/
   dataPoint date='1/1/2005'/
   dataPoint date='1/22/2005'/
 /series

 I want the xField to be derived from the date attribute in the
dataPoint
 - no problem. I want the yField to be based on the yVal attribute in
the
 series (parent of the dataPoints) element. How can I do this?

 mx:PlotSeries
   dataProvider={weightSeries.dataPoint}
   xField=@date
   yField=   ?? What do I put here ??
 /
 There must be a way. Please help! Thanks

 THE FOLLOWING WORKS but I don't want to have to repeat the y value in
 every data point.

 series
   dataPoint date='12/01/2004' yVal='Weight'/
   dataPoint date='12/25/2004' yVal='Weight'/
   dataPoint date='1/1/2005' yVal='Weight'/
   dataPoint date='1/22/2005' yVal='Weight'/
 /series

 mx:PlotSeries
   dataProvider={weightSeries.dataPoint}
   xField=@date
   yField=@yVal
 /



 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
 Links