Effect of time zone with DateTime Axis in Flex

Use LineChart with DateTimeAxis as horizontalAxis and used the dateParseFunction to parse date (format : “2005, 7, 27”)

public function dateParseFunction(s:String):Date{
// Get an array of Strings from the comma-separated String passed in.
var a:Array = s.split(“,”);
// Create the new Date object. Subtract one from
// the month property because months are zero-based in
// the Date constructor.
var newDate:Date = new Date(a[0],a[1]-1,a[2]);
return newDate;
}

Now click on  calender of machine , set the timezone to India(GMT +05:30) , build the project, see the output.

Now change the timezone to some considerable different time(GMT -05:00), build the project, see the output in different window.

Both output chart has difference.

Do u know why it is so?

On research I found that while creating instance of new Date month,year and day will be the same but the remaining hr,min and second values are as per the time zone which we are not setting. And because of that chart points are shifted slightly.

But I  used some different method to overcome this problem:

Removed the dateTimeAxis and used the Category axis, but for that convert date values coming from the backend as string value. Now there is no issue of different time zone.

Want to know if any other solution you have.

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: