source: code/Website/php-ofc-library/ofc_line.php@ 7855

Last change on this file since 7855 was 7849, checked in by dennisw, 15 years ago
File size: 2.8 KB
Line 
1<?php
2
3class line_on_show
4{
5 /**
6 *@param $type as string. Can be any one of:
7 * - 'pop-up'
8 * - 'explode'
9 * - 'mid-slide'
10 * - 'drop'
11 * - 'fade-in'
12 * - 'shrink-in'
13 *
14 * @param $cascade as float. Cascade in seconds
15 * @param $delay as float. Delay before animation starts in seconds.
16 */
17 function __construct($type, $cascade, $delay)
18 {
19 $this->type = $type;
20 $this->cascade = (float)$cascade;
21 $this->delay = (float)$delay;
22 }
23}
24
25class line
26{
27 function line()
28 {
29 $this->type = "line";
30 $this->values = array();
31 }
32
33 /**
34 * Set the default dot that all the real
35 * dots inherit their properties from. If you set the
36 * default dot to be red, all values in your chart that
37 * do not specify a colour will be red. Same for all the
38 * other attributes such as tooltip, on-click, size etc...
39 *
40 * @param $style as any class that inherits base_dot
41 */
42 function set_default_dot_style( $style )
43 {
44 $tmp = 'dot-style';
45 $this->$tmp = $style;
46 }
47
48 /**
49 * @param $v as array, can contain any combination of:
50 * - integer, Y position of the point
51 * - any class that inherits from dot_base
52 * - <b>null</b>
53 */
54 function set_values( $v )
55 {
56 $this->values = $v;
57 }
58
59 /**
60 * Append a value to the line.
61 *
62 * @param mixed $v
63 */
64 function append_value($v)
65 {
66 $this->values[] = $v;
67 }
68
69 function set_width( $width )
70 {
71 $this->width = $width;
72 }
73
74 function set_colour( $colour )
75 {
76 $this->colour = $colour;
77 }
78
79 /**
80 * sytnatical sugar for set_colour
81 */
82 function colour( $colour )
83 {
84 $this->set_colour( $colour );
85 return $this;
86 }
87
88 function set_halo_size( $size )
89 {
90 $tmp = 'halo-size';
91 $this->$tmp = $size;
92 }
93
94 function set_key( $text, $font_size )
95 {
96 $this->text = $text;
97 $tmp = 'font-size';
98 $this->$tmp = $font_size;
99 }
100
101 function set_tooltip( $tip )
102 {
103 $this->tip = $tip;
104 }
105
106 /**
107 * @param $text as string. A javascript function name as a string. The chart will
108 * try to call this function, it will pass the chart id as the only parameter into
109 * this function. E.g:
110 *
111 */
112 function set_on_click( $text )
113 {
114 $tmp = 'on-click';
115 $this->$tmp = $text;
116 }
117
118 function loop()
119 {
120 $this->loop = true;
121 }
122
123 function line_style( $s )
124 {
125 $tmp = "line-style";
126 $this->$tmp = $s;
127 }
128
129 /**
130 * Sets the text for the line.
131 *
132 * @param string $text
133 */
134 function set_text($text)
135 {
136 $this->text = $text;
137 }
138
139 function attach_to_right_y_axis()
140 {
141 $this->axis = 'right';
142 }
143
144 /**
145 *@param $on_show as line_on_show object
146 */
147 function set_on_show($on_show)
148 {
149 $this->{'on-show'} = $on_show;
150 }
151
152 function on_show($on_show)
153 {
154 $this->set_on_show($on_show);
155 return $this;
156 }
157}
Note: See TracBrowser for help on using the repository browser.