1 | package charts.series.bars {
|
---|
2 |
|
---|
3 | import flash.display.Sprite;
|
---|
4 | import charts.series.bars.Base;
|
---|
5 |
|
---|
6 | public class Sketch extends Base {
|
---|
7 | private var outline:Number;
|
---|
8 | private var offset:Number;
|
---|
9 |
|
---|
10 | public function Sketch( index:Number, props:Properties, group:Number ) {
|
---|
11 |
|
---|
12 | super(index, props, group);
|
---|
13 | //super(index, {'top':props.get('top')}, props.get_colour('colour'), props.get('tip'), props.get('alpha'), group);
|
---|
14 | this.outline = props.get_colour('outline-colour');
|
---|
15 | this.offset = props.get('offset');
|
---|
16 | }
|
---|
17 |
|
---|
18 |
|
---|
19 | public override function resize( sc:ScreenCoordsBase ):void {
|
---|
20 |
|
---|
21 | var h:Object = this.resize_helper( sc as ScreenCoords );
|
---|
22 |
|
---|
23 | // how sketchy the bar is:
|
---|
24 | var offset:Number = this.offset;
|
---|
25 | var o2:Number = offset/2;
|
---|
26 |
|
---|
27 | // fill the bar
|
---|
28 | // number of pen strokes:
|
---|
29 | var strokes:Number = 6;
|
---|
30 | // how wide each pen will need to be:
|
---|
31 | var l_width:Number = h.width/strokes;
|
---|
32 |
|
---|
33 | this.graphics.clear();
|
---|
34 | this.graphics.lineStyle( l_width+1, this.colour, 0.85, true, "none", "round", "miter", 0.8 );
|
---|
35 | for( var i:Number=0; i<strokes; i++ )
|
---|
36 | {
|
---|
37 | this.graphics.moveTo( ((l_width*i)+(l_width/2))+(Math.random()*offset-o2), 2+(Math.random()*offset-o2) );
|
---|
38 | this.graphics.lineTo( ((l_width*i)+(l_width/2))+(Math.random()*offset-o2), h.height-2+ (Math.random()*offset-o2) );
|
---|
39 | }
|
---|
40 |
|
---|
41 | // outlines:
|
---|
42 | this.graphics.lineStyle( 2, this.outline, 1 );
|
---|
43 | // left upright
|
---|
44 | this.graphics.moveTo( Math.random()*offset-o2, Math.random()*offset-o2 );
|
---|
45 | this.graphics.lineTo( Math.random()*offset-o2, h.height+Math.random()*offset-o2 );
|
---|
46 |
|
---|
47 | // top
|
---|
48 | this.graphics.moveTo( Math.random()*offset-o2, Math.random()*offset-o2 );
|
---|
49 | this.graphics.lineTo( h.width+ (Math.random()*offset-o2), Math.random()*offset-o2 );
|
---|
50 |
|
---|
51 | // right upright
|
---|
52 | this.graphics.moveTo( h.width+ (Math.random()*offset-o2), Math.random()*offset-o2 );
|
---|
53 | this.graphics.lineTo( h.width+ (Math.random()*offset-o2), h.height+ (Math.random()*offset-o2) );
|
---|
54 |
|
---|
55 | // bottom
|
---|
56 | this.graphics.moveTo( Math.random()*offset-o2, h.height+ (Math.random()*offset-o2) );
|
---|
57 | this.graphics.lineTo( h.width+ (Math.random()*offset-o2), h.height+ (Math.random()*offset-o2) );
|
---|
58 |
|
---|
59 | }
|
---|
60 | }
|
---|
61 | }
|
---|