Rev | Line | |
---|
[7849] | 1 | package charts {
|
---|
| 2 | import flash.display.Sprite;
|
---|
| 3 | import flash.geom.Point;
|
---|
| 4 | import string.Utils;
|
---|
| 5 |
|
---|
| 6 | public class Shape extends Base {
|
---|
| 7 |
|
---|
| 8 | private var style:Object;
|
---|
| 9 |
|
---|
| 10 | public function Shape( json:Object )
|
---|
| 11 | {
|
---|
| 12 | this.style = {
|
---|
| 13 | points: [],
|
---|
| 14 | colour: '#808080',
|
---|
| 15 | alpha: 0.5
|
---|
| 16 | };
|
---|
| 17 |
|
---|
| 18 | object_helper.merge_2( json, this.style );
|
---|
| 19 |
|
---|
| 20 | this.style.colour = string.Utils.get_colour( this.style.colour );
|
---|
| 21 |
|
---|
| 22 | for each ( var val:Object in json.values )
|
---|
| 23 | this.style.points.push( new flash.geom.Point( val.x, val.y ) );
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | public override function resize( sc:ScreenCoordsBase ): void {
|
---|
| 27 |
|
---|
| 28 | this.graphics.clear();
|
---|
| 29 | //this.graphics.lineStyle( this.style.width, this.style.colour );
|
---|
| 30 | this.graphics.lineStyle( 0, 0, 0 );
|
---|
| 31 | this.graphics.beginFill( this.style.colour, this.style.alpha );
|
---|
| 32 |
|
---|
| 33 | var moved:Boolean = false;
|
---|
| 34 |
|
---|
| 35 | for each( var p:flash.geom.Point in this.style.points ) {
|
---|
| 36 | if( !moved )
|
---|
| 37 | this.graphics.moveTo( sc.get_x_from_val(p.x), sc.get_y_from_val(p.y) );
|
---|
| 38 | else
|
---|
| 39 | this.graphics.lineTo( sc.get_x_from_val(p.x), sc.get_y_from_val(p.y) );
|
---|
| 40 |
|
---|
| 41 | moved = true;
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | this.graphics.endFill();
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.