[flexcoders] Re: Displaying a date in a line chart

2008-09-11 Thread gr33neye501
Thanks guys (Tom and yourself), I want to stick with the 
DateTimeAxis, for the very reason the you just mention.

my data is already collection of dates and want to/need to keep it 
that way. So label function it is then. Thanks once again.

J.

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

 Hi,
 
 Here are two approaches I've used:
 
 1) Using a DateTimeAxis:
  If the data representing your dates is in the format that can be 
easily converted into a 
 Date object (see docs for the Date constructor), your DateTimeAxis 
will understand the 
 dates implicitly. Otherwise, you need to write a parseFunction (see 
DateTimeAxis docs) so 
 your data can be converted into a Date object.
 
 Then as Tom suggested, use the labelFunction property to specify a 
function that will 
 return a properly formatted date string ... in the labelFunction 
use a DateFormatter to 
 print the dates in the UK format ( or just use the Date object's 
toLocale method).
 
 2) Using a CategoryAxis:
 Instead of using a DateTimeAxis, consider using a CategoryAxis. 
This approach is similar, 
 except now you don't need to worry about writing a parseFunction.  
Just write a 
 labelFunction as described above.
 
 The CategoryAxis won't deal with dates as nicely as DateTimeAxis, 
but it works nicely for 
 fixed date ranges (it wouldn't be so good for doing a Google 
Finance type of chart where 
 you can change time frames of the chart).
 
 Check out the docs for the labelFunction and parseFunction 
properties of the 
 DateTimeAxis (or CategoryAxis). They show the function signature 
that's required, from 
 there it's easy :)
 
 Sunil
 
 --- In flexcoders@yahoogroups.com, Tom Chiverton tom.chiverton@ 
wrote:
 
  On Wednesday 10 Sep 2008, gr33neye501 wrote:
   The data is a collection of Date objects, and is displayed in US
   format. I am trying to get the axis to display the date in 
DD/YY/
   or DD/MM/YY format.
  
  Just use a label function on the Axis(Renderer).
  
  -- 
  Tom Chiverton
  
  
  
  This email is sent for and on behalf of Halliwells LLP.
  
  Halliwells LLP is a limited liability partnership registered in 
England and Wales under 
 registered number OC307980 whose registered office address is at 
Halliwells LLP, 3 
 Hardman Square, Spinningfields, Manchester, M3 3EB.  A list of 
members is available for 
 inspection at the registered office. Any reference to a partner in 
relation to Halliwells LLP 
 means a member of Halliwells LLP.  Regulated by The Solicitors 
Regulation Authority.
  
  CONFIDENTIALITY
  
  This email is intended only for the use of the addressee named 
above and may be 
 confidential or legally privileged.  If you are not the addressee 
you must not read it and 
 must not use any information contained in nor copy it nor inform 
any person other than 
 Halliwells LLP or the addressee of its existence or contents.  If 
you have received this email 
 in error please delete it and notify Halliwells LLP IT Department 
on 0870 365 2500.
  
  For more information about Halliwells LLP visit 
www.halliwells.com.
 





[flexcoders] Re: Displaying a date in a line chart

2008-09-10 Thread sunild999999
Hi,

Here are two approaches I've used:

1) Using a DateTimeAxis:
 If the data representing your dates is in the format that can be easily 
converted into a 
Date object (see docs for the Date constructor), your DateTimeAxis will 
understand the 
dates implicitly. Otherwise, you need to write a parseFunction (see 
DateTimeAxis docs) so 
your data can be converted into a Date object.

Then as Tom suggested, use the labelFunction property to specify a function 
that will 
return a properly formatted date string ... in the labelFunction use a 
DateFormatter to 
print the dates in the UK format ( or just use the Date object's toLocale 
method).

2) Using a CategoryAxis:
Instead of using a DateTimeAxis, consider using a CategoryAxis. This approach 
is similar, 
except now you don't need to worry about writing a parseFunction.  Just write a 
labelFunction as described above.

The CategoryAxis won't deal with dates as nicely as DateTimeAxis, but it works 
nicely for 
fixed date ranges (it wouldn't be so good for doing a Google Finance type of 
chart where 
you can change time frames of the chart).

Check out the docs for the labelFunction and parseFunction properties of the 
DateTimeAxis (or CategoryAxis). They show the function signature that's 
required, from 
there it's easy :)

Sunil

--- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED] wrote:

 On Wednesday 10 Sep 2008, gr33neye501 wrote:
  The data is a collection of Date objects, and is displayed in US
  format. I am trying to get the axis to display the date in DD/YY/
  or DD/MM/YY format.
 
 Just use a label function on the Axis(Renderer).
 
 -- 
 Tom Chiverton
 
 
 
 This email is sent for and on behalf of Halliwells LLP.
 
 Halliwells LLP is a limited liability partnership registered in England and 
 Wales under 
registered number OC307980 whose registered office address is at Halliwells 
LLP, 3 
Hardman Square, Spinningfields, Manchester, M3 3EB.  A list of members is 
available for 
inspection at the registered office. Any reference to a partner in relation to 
Halliwells LLP 
means a member of Halliwells LLP.  Regulated by The Solicitors Regulation 
Authority.
 
 CONFIDENTIALITY
 
 This email is intended only for the use of the addressee named above and may 
 be 
confidential or legally privileged.  If you are not the addressee you must not 
read it and 
must not use any information contained in nor copy it nor inform any person 
other than 
Halliwells LLP or the addressee of its existence or contents.  If you have 
received this email 
in error please delete it and notify Halliwells LLP IT Department on 0870 365 
2500.
 
 For more information about Halliwells LLP visit www.halliwells.com.