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);
}
}
}
}