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);
                }
            }
        }
    }
  • 相关阅读:
    让 .Net 程序 脱离 .net framework框架 运行的方法 转
    MySpaces性能提高的过程转
    AskNet 内容查询系统 筹备中
    关于自定义表单的一些想法
    Url重写
    show一下我的办公桌
    IronRuby 初览
    微软将终止对SQL2000的支持
    WCF 消息交换 转
    感受刘德华的努力
  • 原文地址:https://www.cnblogs.com/GameCode/p/3373179.html
Copyright © 2011-2022 走看看