灵活日期和时间股票图表 (HOLC) - 需要帮助

发布于 2024-09-16 19:18:45 字数 4801 浏览 7 评论 0原文

我试图在 Flex 3.5 股票 HOLC(最高价、开盘价、最低价、收盘价)图表中显示日期和时间。该数据显示但格式不正确... 问题: 1. 时间不正常.. 与正确时间不一致.. (是因为不是军用时间吗)? 2.底部标签上没有显示日期(天),有什么办法可以做到这一点吗? 3. 时间显示出很大的差距...在 24 小时内...当数据暂时不存在时是否总是出现这种情况?或者,我可以禁用特定的时间段,就像“禁用天”一样

有什么建议吗?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script><![CDATA[
     import mx.collections.ArrayCollection
    [Bindable]
     public var TICKER:ArrayCollection = new ArrayCollection([
        {date:"1/8/05 8:30:00 AM",open:42.57,high:43.08,low:42.08,close:42.75},
        {date:"1/8/05 9:00:00 AM",open:42.89,high:43.5,low:42.61,close:43.19},
        {date:"1/8/05 9:30:00 AM",open:43.19,high:43.31,low:42.77,close:43.22},
        {date:"1/8/05 10:00:00 AM",open:42.89,high:43,low:42.29,close:42.71},
        {date:"1/8/05 10:30:00 AM",open:42.49,high:43.36,low:42.02,close:42.99},
        {date:"1/8/05 11:00:00 AM",open:43,high:43.25,low:42.61,close:42.65},
        {date:"1/8/05 11:30:00 AM",open:42.93,high:43.89,low:42.91,close:43.82},
        {date:"1/8/05 12:00:00 PM",open:44,high:44.39,low:43.31,close:43.38},
        {date:"1/8/05 12:30:00 PM",open:43.39,high:44.12,low:43.25,close:44},
        {date:"1/8/05 1:00:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"1/8/05 1:30:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"1/8/05 2:00:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"1/8/05 2:30:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"1/8/05 3:00:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"2/8/05 8:30:00 AM",open:42.57,high:43.08,low:42.08,close:42.75},
        {date:"2/8/05 9:00:00 AM",open:42.89,high:43.5,low:42.61,close:43.19},
        {date:"2/8/05 9:30:00 AM",open:43.19,high:43.31,low:42.77,close:43.22},
        {date:"2/8/05 10:00:00 AM",open:42.89,high:43,low:42.29,close:42.71},
        {date:"2/8/05 10:30:00 AM",open:42.49,high:43.36,low:42.02,close:42.99},
        {date:"2/8/05 11:00:00 AM",open:43,high:43.25,low:42.61,close:42.65},
        {date:"2/8/05 11:30:00 AM",open:42.93,high:43.89,low:42.91,close:43.82},
        {date:"2/8/05 12:00:00 PM",open:44,high:44.39,low:43.31,close:43.38},
        {date:"2/8/05 12:30:00 PM",open:43.39,high:44.12,low:43.25,close:44},
        {date:"2/8/05 1:00:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"2/8/05 1:30:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"2/8/05 2:00:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"2/8/05 2:30:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"2/8/05 3:00:00 PM",open:43.46,high:46.22,low:43.36,close:46.1}
     ]);
  ]]></mx:Script>

  <mx:Panel title="HighLowOpenClose Chart">
     <mx:HLOCChart id="myChart" 
        dataProvider="{TICKER}" 
        showDataTips="true"
     >
        <mx:verticalAxis>
           <mx:LinearAxis minimum="30" maximum="50"/>
        </mx:verticalAxis>
        <mx:series>
           <mx:HLOCSeries
                dataProvider="{TICKER}"
                openField="open"
                highField="high"
                lowField="low"
                closeField="close"
                displayName="TICKER"
                xField="date"  >
           </mx:HLOCSeries>
        </mx:series>

            <mx:horizontalAxis>
                <mx:DateTimeAxis 
                    parseFunction="{myParseFunction}"   
                    id="dt1"
                    disabledDays="[0,1]"
                    dataUnits="hours"
                    alignLabelsToUnits="true"
                    labelUnits="hours" />
            </mx:horizontalAxis>

            <mx:horizontalAxisRenderers>
                <mx:AxisRenderer
                    id="dt1Rnd" 
                    showLabels="true" 
                    axis="{dt1}"  
                    visible="true"
                    minWidth="1"  />
            </mx:horizontalAxisRenderers>         

     </mx:HLOCChart>
     <mx:Legend dataProvider="{myChart}"/>
  </mx:Panel>
  <mx:Script>
    <![CDATA[
    public function myParseFunction(s:String):Date {
        // Get an array of Strings from the 
        // comma-separated String passed in.
        var a:Array = s.split(/:|\/|\s/);
        trace("String a : " + a.toString());
        // Trace out year, month, and day values.
        // To create a Date object, you pass "YYYY,MM,DD", 
        // where MM is zero-based, to the Date() constructor.
        var newDate:Date = new Date(a[2],a[1],a[0],a[3],a[4]);
        return newDate;
        }
    ]]>
  </mx:Script>
 </mx:Application>

I am trying to show BOTH the date and the time in Flex 3.5 Stock HOLC (high, open, low, close) Chart. This data shows up but not in the correct format...
Problems:
1. The time are out of whack.. they do not line up with proper time.. (is it because they are not military time)?
2. The dates (days) do not show up on the bottom labels are all, is there a way to make this happen?
3. The times show up with large gaps... in the 24 hour period... Is this always the case when the data is not there for the time? Or, can I disable specific time periods like is possible with "disable days"

Any suggestions?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script><![CDATA[
     import mx.collections.ArrayCollection
    [Bindable]
     public var TICKER:ArrayCollection = new ArrayCollection([
        {date:"1/8/05 8:30:00 AM",open:42.57,high:43.08,low:42.08,close:42.75},
        {date:"1/8/05 9:00:00 AM",open:42.89,high:43.5,low:42.61,close:43.19},
        {date:"1/8/05 9:30:00 AM",open:43.19,high:43.31,low:42.77,close:43.22},
        {date:"1/8/05 10:00:00 AM",open:42.89,high:43,low:42.29,close:42.71},
        {date:"1/8/05 10:30:00 AM",open:42.49,high:43.36,low:42.02,close:42.99},
        {date:"1/8/05 11:00:00 AM",open:43,high:43.25,low:42.61,close:42.65},
        {date:"1/8/05 11:30:00 AM",open:42.93,high:43.89,low:42.91,close:43.82},
        {date:"1/8/05 12:00:00 PM",open:44,high:44.39,low:43.31,close:43.38},
        {date:"1/8/05 12:30:00 PM",open:43.39,high:44.12,low:43.25,close:44},
        {date:"1/8/05 1:00:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"1/8/05 1:30:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"1/8/05 2:00:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"1/8/05 2:30:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"1/8/05 3:00:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"2/8/05 8:30:00 AM",open:42.57,high:43.08,low:42.08,close:42.75},
        {date:"2/8/05 9:00:00 AM",open:42.89,high:43.5,low:42.61,close:43.19},
        {date:"2/8/05 9:30:00 AM",open:43.19,high:43.31,low:42.77,close:43.22},
        {date:"2/8/05 10:00:00 AM",open:42.89,high:43,low:42.29,close:42.71},
        {date:"2/8/05 10:30:00 AM",open:42.49,high:43.36,low:42.02,close:42.99},
        {date:"2/8/05 11:00:00 AM",open:43,high:43.25,low:42.61,close:42.65},
        {date:"2/8/05 11:30:00 AM",open:42.93,high:43.89,low:42.91,close:43.82},
        {date:"2/8/05 12:00:00 PM",open:44,high:44.39,low:43.31,close:43.38},
        {date:"2/8/05 12:30:00 PM",open:43.39,high:44.12,low:43.25,close:44},
        {date:"2/8/05 1:00:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"2/8/05 1:30:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"2/8/05 2:00:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"2/8/05 2:30:00 PM",open:43.46,high:46.22,low:43.36,close:46.1},
        {date:"2/8/05 3:00:00 PM",open:43.46,high:46.22,low:43.36,close:46.1}
     ]);
  ]]></mx:Script>

  <mx:Panel title="HighLowOpenClose Chart">
     <mx:HLOCChart id="myChart" 
        dataProvider="{TICKER}" 
        showDataTips="true"
     >
        <mx:verticalAxis>
           <mx:LinearAxis minimum="30" maximum="50"/>
        </mx:verticalAxis>
        <mx:series>
           <mx:HLOCSeries
                dataProvider="{TICKER}"
                openField="open"
                highField="high"
                lowField="low"
                closeField="close"
                displayName="TICKER"
                xField="date"  >
           </mx:HLOCSeries>
        </mx:series>

            <mx:horizontalAxis>
                <mx:DateTimeAxis 
                    parseFunction="{myParseFunction}"   
                    id="dt1"
                    disabledDays="[0,1]"
                    dataUnits="hours"
                    alignLabelsToUnits="true"
                    labelUnits="hours" />
            </mx:horizontalAxis>

            <mx:horizontalAxisRenderers>
                <mx:AxisRenderer
                    id="dt1Rnd" 
                    showLabels="true" 
                    axis="{dt1}"  
                    visible="true"
                    minWidth="1"  />
            </mx:horizontalAxisRenderers>         

     </mx:HLOCChart>
     <mx:Legend dataProvider="{myChart}"/>
  </mx:Panel>
  <mx:Script>
    <![CDATA[
    public function myParseFunction(s:String):Date {
        // Get an array of Strings from the 
        // comma-separated String passed in.
        var a:Array = s.split(/:|\/|\s/);
        trace("String a : " + a.toString());
        // Trace out year, month, and day values.
        // To create a Date object, you pass "YYYY,MM,DD", 
        // where MM is zero-based, to the Date() constructor.
        var newDate:Date = new Date(a[2],a[1],a[0],a[3],a[4]);
        return newDate;
        }
    ]]>
  </mx:Script>
 </mx:Application>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

漫雪独思 2024-09-23 19:18:45
  1. 不,日期就可以,不需要那种格式。
  2. 检查代码http://pastebin.com/9Y443NFv
  3. 是的,使用disabledRanges

你也可以在这里找到有趣的东西代码也:
http://www.meutzner.com/blog/attachments/360/ srcview/index.html

问候
尤金

  1. No, dates are fine, no needs in that format.
  2. Check the code http://pastebin.com/9Y443NFv
  3. Yes, use disabledRanges

also you can find interesting things in this code too:
http://www.meutzner.com/blog/attachments/360/srcview/index.html

Regards
Eugene

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文