Peter...usually that's a problem of time zones. i.e., you're specifying
your times in local time, and the DateTimeAxis is rendering in UTC.  So
Jan 1 in local time becomes Dec 31 in UTC, for example.

 

Ely.

 

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Peter Demling
Sent: Monday, April 23, 2007 10:44 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] DateTimeAxis problem: aligning dates with their
year value

 

Experiencing an interesting problem with the DateTimeAxis. Below is
the full code for a very simple LineChart app that's charting one data
value across a DateTimeAxis (this a small variation of the
DateTimeAxis example from livedocs). The date values for the
DateTimeAxis are String values in a local ArrayCollection in the
accepted "MM/DD/YYYY" format.

The problem is, all of the dates are getting charted one month too
soon. This is especially apparent in this example, where all of the
dates are on January 1st of each year: the data points are clearly
lagging behind the year points on the x-axis (I added a verticalStroke
here to show the discrepancy more clearly). If I change all of the
data points to February-1st, they all get incorrectly drawn exactlty
on the year-line.

Any suggestions are appreciated!

Thanks,
-Peter Demling
Lexington, MA

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; width="100%"
height="100%">

<mx:Script><![CDATA[
import mx.collections.ArrayCollection
[Bindable] public var aapl:ArrayCollection = new ArrayCollection([
{date: "01/01/2001", close: 22.71},
{date: "01/01/2002", close: 12.71},
{date: "01/01/2003", close: 42.71},
{date: "01/01/2004", close: 52.99},
{date: "01/01/2005", close: 42.65},
{date: "01/01/2006", close: 62.65},
{date: "01/01/2007", close: 22.65},
{date: "01/01/2008", close: 72.65},
{date: "01/01/2009", close: 82.65}
]);
]]></mx:Script>

<mx:Panel title="DateTimeAxis - Year alignment problem"
width="100%" height="100%">
<mx:LineChart id="mychart" dataProvider="{aapl}"
showDataTips="true"
height="100%" width="100%">
<mx:horizontalAxis>
<mx:DateTimeAxis/>
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries yField="close" xField="date"
displayName="AAPL"/>
</mx:series>
<mx:backgroundElements>
<mx:GridLines direction="vertical">
<mx:verticalStroke>
<mx:Stroke weight="3"/>
</mx:verticalStroke>
</mx:GridLines>
</mx:backgroundElements>
</mx:LineChart> 
</mx:Panel>
</mx:Application>

 

<<attachment: image001.jpg>>

<<attachment: image002.jpg>>

Reply via email to