Flex DateTimeAxis 重复轴标签值
这个简单的代码在水平日期时间轴上的 2 个位置上生成 11 月 7 日:
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.charts.series.LineSeries;
import mx.collections.ArrayCollection;
[Bindable]
public var ac:ArrayCollection = new ArrayCollection(
[
{completions: "11636", date: new Date(2010, 10, 7)},
{completions: "33060", date: new Date(2010, 10, 8)},
]);
]]>
</mx:Script>
<mx:Panel title="Bar Chart">
<mx:BarChart id="myChart"
dataProvider="{ac}">
<mx:horizontalAxis>
<mx:DateTimeAxis dataUnits="days"
displayLocalTime="true"/>
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries xField="date" yField="completions"/>
</mx:series>
</mx:BarChart>
</mx:Panel>
</mx:Application>
将日期更改为 11 月 8 日和 9 日,一切都很好......
有人知道如何解决此问题吗?
This simple code results in November 7th in 2 places on the horizontal dateTimeAxis:
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.charts.series.LineSeries;
import mx.collections.ArrayCollection;
[Bindable]
public var ac:ArrayCollection = new ArrayCollection(
[
{completions: "11636", date: new Date(2010, 10, 7)},
{completions: "33060", date: new Date(2010, 10, 8)},
]);
]]>
</mx:Script>
<mx:Panel title="Bar Chart">
<mx:BarChart id="myChart"
dataProvider="{ac}">
<mx:horizontalAxis>
<mx:DateTimeAxis dataUnits="days"
displayLocalTime="true"/>
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries xField="date" yField="completions"/>
</mx:series>
</mx:BarChart>
</mx:Panel>
</mx:Application>
Change the dates to November 8th and 9th and all is good....
Anyone have any ideas how to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
看起来它与 UTC 时间有关,因为这修复了它:
但是,我不想这样做......
It looks like it has something to do with UTC time as this fixes it:
But, I'd rather not do this...
首先,好人输入了整个应用程序代码(方便运行)。
复制它并在 Flex Builder 3 中运行它,它给了我两个日期:10/11/7 和 10/11/8。这就是您正在寻找的内容(假设该月份是从零开始的)。一定是地域问题。
这是第一次约会的调试视图,也许可以根据您的查看详细信息(注意时间偏移)
Firstly, good man for putting in the entire app code (handy for running).
Copied it and ran it in Flex Builder 3, and it gave me the two dates, 11/7/10 and 11/8/10. Which is what you were looking for (given that month is zero based). Must be a locale thing.
Here is a debug view of the first date, maybe check details against yours (note the time offset)
布莱恩·毕肖普提到了时区偏移,这让我开始思考。这是一个更简单的应用程序:
这是我的机器(在丹佛)上的属性(注意 timezoneOffset 属性。我怀疑差异是因为 11/7 是夏令时):
由于某种原因,带有 displayLocalTime=true 的 datetimeaxis 将 d2.date 转换为 7 而不是 8。
brian bishop mentioned timezone offset, so that got me thinking. here's a simpler app:
and here's what the properties look like on my machine (in Denver) (note the timezoneOffset property. the difference i suspect is because 11/7 was daylight savings day):
for some reason, datetimeaxis with displayLocalTime=true, converts d2.date to 7 instead of 8.
我在我的应用程序中使用以下函数进行日期比较,而不是使用 new Date(obj) ,它对我有用。您也可以尝试一下!
注意:在我的例子中,“value”参数是一个字符串“02/07/2011”。
I used the below function for Date comparison in my application instead of having new Date(obj) and it worked for me.You can also give it a try!
Note:'value' param was a String "02/07/2011" in my case.