Welcome to mirror list, hosted at ThFree Co, Russian Federation.

XLegend.as « actionscript « open-flash-chart « libs - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a55af62b5247475be7889ec1afc5da546707b2e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
class XLegend extends Title
{

	// override the MovieClip name:
	private var name:String = 'x_legend';
	public var mc:TextField;
	
	function XLegend( lv:LoadVars )
	{
		if( lv.x_legend == undefined )
			return;
			
		var tmp:Array = lv.x_legend.split(',');
		
		var text:String = tmp[0];
		this.size = Number( tmp[1] );
		this.colour = _root.get_colour( tmp[2] );
		
		// call our parent (Title) constructor:
		// super.build( text );
		
		// while no CSS :
		this.build( text );
	}
	
	// remove when this gets CSS
	function build( text:String )
	{
		this.title = text;
		
		if( this.mc == undefined )
			this.mc = _root.createTextField( 'title', _root.getNextHighestDepth(), 0, 0, 200, 200 );
			
		this.mc.text = this.title;
		
		var fmt:TextFormat = new TextFormat();
		fmt.color = this.colour;
		fmt.font = "Verdana";
		fmt.size = this.size;
		
		fmt.align = "center";
	
		this.mc.setTextFormat(fmt);
		this.mc.autoSize = "left";
	}
	
	function get_legend()
	{
		return this.title;
	}
	
	function move()
	{
		// this will center it in the X
		super.move();
		// this will align bottom:
		this.mc._y = Stage.height - this.mc._height;
	}
	
	//
	// this is only here while title has CSS and x legend does not.
	// remove this when we put css in this object
	//
	function height()
	{
		// the title may be turned off:
		if( this.mc == undefined )
			return 0;
		else
			return this.mc._height;
	}
}