source: code/Website/open-flash-chart/elements/axis/YAxisLabelsRight.as@ 7849

Last change on this file since 7849 was 7849, checked in by dennisw, 15 years ago
File size: 1.1 KB
Line 
1package elements.axis {
2 import flash.text.TextField;
3
4 public class YAxisLabelsRight extends YAxisLabelsBase {
5
6 public function YAxisLabelsRight(json:Object) {
7
8 this.lblText = "#val#";
9 this.i_need_labels = true;
10
11 super(json, 'y_axis_right');
12 }
13
14 // move y axis labels to the correct x pos
15 public override function resize( left:Number, box:ScreenCoords ):void {
16 var maxWidth:Number = this.get_width();
17 var i:Number;
18 var tf:YTextField;
19
20 for( i=0; i<this.numChildren; i++ ) {
21 // left align
22 tf = this.getChildAt(i) as YTextField;
23 tf.x = left; // - tf.width + maxWidth;
24 }
25
26 // now move it to the correct Y, vertical center align
27 for ( i=0; i < this.numChildren; i++ ) {
28 tf = this.getChildAt(i) as YTextField;
29 if (tf.rotation != 0) {
30 tf.y = box.get_y_from_val( tf.y_val, true ) + (tf.height / 2);
31 }
32 else {
33 tf.y = box.get_y_from_val( tf.y_val, true ) - (tf.height / 2);
34 }
35 if (tf.y < 0 && box.top == 0) // Tried setting tf.height but that didnt work
36 tf.y = (tf.rotation != 0) ? tf.height : tf.textHeight - tf.height;
37 }
38 }
39 }
40}
Note: See TracBrowser for help on using the repository browser.