The docs have the usage. In short, the item is the object from your
collection you want to operate on and the fieldName is the field the
chart wants to know about. In your case you would have something like
this:
public function myDataFunction(series:Series, item:Object,
fieldName:String):Object {
if(fieldName == "key")
return(turnYourKeyIntoADate(item));
else if(fieldName == "value")
return(item.value);
else
return null;
}
--- In [email protected], kotha poornima <[EMAIL PROTECTED]>
wrote:
>
> Thanks very much for your response.But i am not aware of this
dataFunction.Can you provide me with an example.The link you sent is
just showing the signature of the method.
>
> Thanks in Advance,
> Poornima
>
>
>
>
> ________________________________
> From: Michael VanDaniker <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Friday, October 24, 2008 10:58:02 AM
> Subject: [flexcoders] Re: Can anyone help me?
>
>
> Since you're plotting dates you'll want to use a DateTimeAxis, but you
> need to make sure that your chart is actually getting Dates. In your
> current setup DateTimeAxis is trying to create Dates using the
> Date.parse method, but the format isn't one that the method can
> handle. That's why you're seeing "Invalid date" for each item.
>
> There are a couple of approaches you can take to get those Dates:
>
> 1) Feed the XML to the series the way you are and define a
> dataFunction for the series. The dataFunction lets you tell the chart
> how it should interpret the data. When you look at the "key" field,
> parse that field into a date and return it.
>
> http://livedocs. adobe.com/ flex/3/langref/ mx/charts/ chartClasses/
Series.html# dataFunction
>
> 2) Pre-process the XML into an ArrayCollection of objects and give
> that collection to the series.
>
> --- In [EMAIL PROTECTED] ups.com, kotha poornima <poorni_agile@ ...>
> wrote:
> >
> > Hi,
> > This is Poornima. Currently iam working on flex, very new to flex. I
> just know the basics such as some UI designing and server-side
> programming in flex. Now i have to work on Flex Charting. I started
> that project by learning the basic charts but now i am having lots of
> doubts in that. Can any one help me?
> >
> > The request goes to the server and response come back to flex in the
> format of XML.XML file looks like:
> > <response>
> > <data>
> > <key>24/10 05</key>
> > <value>500</ value>
> > </data>
> > <data>
> > <key>24/10 06</key>
> > <value>510</ value>
> > </data>
> > <data>
> > <key>24/10 07</key>
> > <value>520</ value>
> > </data>
> > <data>
> > <key>24/10 08</key>
> > <value>530</ value>
> > </data>
> > <data>
> > <key>24/10 09</key>
> > <value>540</ value>
> > </data>
> > <data>
> > <key>24/10 10</key>
> > <value>550</ value>
> > </data>
> > <response>
> >
> >
> > This is the xml response where KEY represents the date and time and
> VALUE represents a particular value for the key.
> > <data>
> > <key>24/10 05</key> -- represents date and time date in the
> format of (DD/MM) 24/10 and time (HH) 05
> > <value>500</ value> -- represents an integer value.
> > </data>
> > Here Key represents x-axis and Value represents y-axis.
> >
> > 1. Which axis is better for this type of xml response?
> >
> > 2. If i use linear axis or category axis it is drawing the graph
> based on first characters of key means in this case of xml it is
> always taking 24 as the key (x-axis point) and different values
> (500,510,520, 530,540,550 etc) as values(y-axis points) showing a
> straight vertical line at a single point of x-axis ie 24. How can i
> overcome this problem and graph will work for different values of key
> ie graph should work for the days iam giving, months iam giving and
> also for hours iam giving? Is there any possibility to do that?
> >
> > 3.Once i tried the samething with DateTimeAxis in X-Axis but it is
> showing "Invalid Date". Iam getting any Graph. How to draw the graph
> with datetime axis with this type of xml responses.
> >
> > 4.If i use DateTime Axis is it really change the graph according to
> the dataUnits i am giving?
> >
> > Can any one give me an idea on how to handle with these issues.
> Please send me replies. Waiting for all your replies..
> >
> > Thanks in Advance.
> > Poornima.
> >
>