Rev | Line | |
---|
[7849] | 1 | package elements.axis {
|
---|
| 2 | import flash.text.TextField;
|
---|
| 3 |
|
---|
| 4 | public class YAxisLabelsLeft extends YAxisLabelsBase {
|
---|
| 5 |
|
---|
| 6 | public function YAxisLabelsLeft(json:Object) {
|
---|
| 7 |
|
---|
| 8 | this.lblText = "#val#";
|
---|
| 9 | this.i_need_labels = true;
|
---|
| 10 |
|
---|
| 11 | super(json,'y_axis');
|
---|
| 12 | }
|
---|
| 13 |
|
---|
| 14 | // move y axis labels to the correct x pos
|
---|
| 15 | public override function resize( left:Number, sc:ScreenCoords ):void {
|
---|
| 16 |
|
---|
| 17 | var maxWidth:Number = this.get_width();
|
---|
| 18 | var i:Number;
|
---|
| 19 | var tf:YTextField;
|
---|
| 20 |
|
---|
| 21 | for( i=0; i<this.numChildren; i++ ) {
|
---|
| 22 | // right align
|
---|
| 23 | tf = this.getChildAt(i) as YTextField;
|
---|
| 24 | tf.x = left - tf.width + maxWidth;
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | // now move it to the correct Y, vertical center align
|
---|
| 28 | for ( i=0; i < this.numChildren; i++ ) {
|
---|
| 29 | tf = this.getChildAt(i) as YTextField;
|
---|
| 30 | if (tf.rotation != 0) {
|
---|
| 31 | tf.y = sc.get_y_from_val( tf.y_val, false ) + (tf.height / 2);
|
---|
| 32 | }
|
---|
| 33 | else {
|
---|
| 34 | tf.y = sc.get_y_from_val( tf.y_val, false ) - (tf.height / 2);
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | //
|
---|
| 38 | // this is a hack so if the top
|
---|
| 39 | // label is off the screen (no chart title or key set)
|
---|
| 40 | // then move it down a little.
|
---|
| 41 | //
|
---|
| 42 | if (tf.y < 0 && sc.top == 0) // Tried setting tf.height but that didnt work
|
---|
| 43 | tf.y = (tf.rotation != 0) ? tf.height : tf.textHeight - tf.height;
|
---|
| 44 | }
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.