1 | <?php
|
---|
2 |
|
---|
3 | /* this is a base class */
|
---|
4 |
|
---|
5 | class bar_base
|
---|
6 | {
|
---|
7 | function bar_base(){}
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * @param $text as string the key text
|
---|
11 | * @param $size as integer, size in pixels
|
---|
12 | */
|
---|
13 | function set_key( $text, $size )
|
---|
14 | {
|
---|
15 | $this->text = $text;
|
---|
16 | $tmp = 'font-size';
|
---|
17 | $this->$tmp = $size;
|
---|
18 | }
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * syntatical sugar.
|
---|
22 | */
|
---|
23 | function key( $text, $size )
|
---|
24 | {
|
---|
25 | $this->set_key( $text, $size );
|
---|
26 | }
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * @param $v as an array, a mix of:
|
---|
30 | * - a bar_value class. You can use this to customise the paramters of each bar.
|
---|
31 | * - integer. This is the Y position of the top of the bar.
|
---|
32 | */
|
---|
33 | function set_values( $v )
|
---|
34 | {
|
---|
35 | $this->values = $v;
|
---|
36 | }
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * see set_values
|
---|
40 | */
|
---|
41 | function append_value( $v )
|
---|
42 | {
|
---|
43 | $this->values[] = $v;
|
---|
44 | }
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * @param $colour as string, a HEX colour, e.g. '#ff0000' red
|
---|
48 | */
|
---|
49 | function set_colour( $colour )
|
---|
50 | {
|
---|
51 | $this->colour = $colour;
|
---|
52 | }
|
---|
53 |
|
---|
54 | /**
|
---|
55 | *syntatical sugar
|
---|
56 | */
|
---|
57 | function colour( $colour )
|
---|
58 | {
|
---|
59 | $this->set_colour( $colour );
|
---|
60 | }
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * @param $alpha as real number (range 0 to 1), e.g. 0.5 is half transparent
|
---|
64 | */
|
---|
65 | function set_alpha( $alpha )
|
---|
66 | {
|
---|
67 | $this->alpha = $alpha;
|
---|
68 | }
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * @param $tip as string, the tip to show. May contain various magic variables.
|
---|
72 | */
|
---|
73 | function set_tooltip( $tip )
|
---|
74 | {
|
---|
75 | $this->tip = $tip;
|
---|
76 | }
|
---|
77 |
|
---|
78 | /**
|
---|
79 | *@param $on_show as line_on_show object
|
---|
80 | */
|
---|
81 | function set_on_show($on_show)
|
---|
82 | {
|
---|
83 | $this->{'on-show'} = $on_show;
|
---|
84 | }
|
---|
85 |
|
---|
86 | function set_on_click( $text )
|
---|
87 | {
|
---|
88 | $tmp = 'on-click';
|
---|
89 | $this->$tmp = $text;
|
---|
90 | }
|
---|
91 |
|
---|
92 | function attach_to_right_y_axis()
|
---|
93 | {
|
---|
94 | $this->axis = 'right';
|
---|
95 | }
|
---|
96 | }
|
---|
97 |
|
---|