zoukankan      html  css  js  c++  java
  • k线图

    package fwm.byte100.goodsMode
    {
        import flash.display.Sprite;
        import fwm.assist.bit101.components.Label;
     /* description:
      * author:  fwm
      * date:    2013-10-16  下午9:35:15
      * project: ByteGame100  
      * http://www.byte100.com 
      * copyright  2013~2015 by lzn
      */
        public class KlineBg extends Sprite
        {
            private var wBg:int, hBg:int;
            public function KlineBg(_w:int,_h:int)
            {
                wBg = _w;
                hBg = _h;
                this.graphics.lineStyle(2, 0xff0000);
                this.graphics.moveTo(0, 0);
                this.graphics.lineTo(0, hBg);
                this.graphics.lineTo(wBg, hBg);
                new Label(this, -30, _h-10, "25.0");
                for (var i:int = 0; i < 10; i++) {
                    DrawDottedHLine(i * (_h / 10), _w);
                    var lb:Label = new Label(this, -30,i * (_h / 10)-10,  (75 - i * 5).toString()+".0");
                }
                for (var j:int = 1; j < 4; j++) {
                    DrawDottedVLine(j * (_w / 4), _h);
                }
                
                this.graphics.lineStyle(1, 0xFFFFFF);
                DrawK_test(_w);
            }
            
            private function DrawPoint(_time:int, _value:Number):void {
                var y:int = _value * hBg/10
            }
            
            private function DrawK_test(_w:int):void {
                var s:int = 0;
                var m:int = Math.random() * 50 + 25;
                for (var i:int = 0; i < 50; i++) {
                    this.graphics.moveTo(s, m);
                    var d:int = i * (_w / 50);
                    var y:int = (int(Math.random() * 50) + 25)-25;
                    this.graphics.lineTo(d, y);
                    s = d;
                    m = y;
                    trace(y);
                }
            }
            
            private function DrawDottedHLine(_y:int, _w:int):void {
                this.graphics.lineStyle(1, 0xA2270D);
                var s:int = 0;
                var m:int = 4;
                for (var i:int = 0; i < int(_w/6); i++) {
                    this.graphics.moveTo(s, _y);
                    this.graphics.lineTo(m, _y);
                    s = m + 2;
                    m = s + 4;
                    trace(s, "-", m);
                }
            }
            
            private function DrawDottedVLine(_x:int, _h:int):void {
                this.graphics.lineStyle(1, 0xA2270D);
                var s:int = 0;
                var m:int = 4;
                for (var i:int = 0; i < int(_h/6); i++) {
                    this.graphics.moveTo(_x, s);
                    this.graphics.lineTo(_x, m);
                    s = m + 2;
                    m = s + 4;
                    trace(s, "-", m);
                }
            }
        }
    }
  • 相关阅读:
    日期格式不合法
    DataGridView的Scrollbar通過編程不能自動下滾
    Sourcesafe shadown backup
    共享目錄突然不工作 
    VS2005編譯后版本如何控制
    WebBrowser用作RichTextBox
    怎樣設定MS Reporting自動橫向列印
    VSS 2005不需登錄,直接開啟的方法
    subreport cannot be shown
    An Algorithm Summary of Programming Collective Intelligence (5)
  • 原文地址:https://www.cnblogs.com/GameCode/p/3373179.html
Copyright © 2011-2022 走看看