minor bug fix
[openemr.git] / library / openflashchart / php-ofc-library / dot_base.php
blob5772efcd9f7ff7d57822b3b981d89edaddd56b72
1 <?php
3 /**
4 * A private class. All the other line-dots inherit from this.
5 * Gives them all some common methods.
6 */
7 class dot_base
9 /**
10 * @param $type string
11 * @param $value integer
13 function dot_base($type, $value=null)
15 $this->type = $type;
16 if( isset( $value ) )
17 $this->value( $value );
20 /**
21 * For line charts that only require a Y position
22 * for each point.
23 * @param $value as integer, the Y position
25 function value( $value )
27 $this->value = $value;
30 /**
31 * For scatter charts that require an X and Y position for
32 * each point.
34 * @param $x as integer
35 * @param $y as integer
37 function position( $x, $y )
39 $this->x = $x;
40 $this->y = $y;
43 /**
44 * @param $colour is a string, HEX colour, e.g. '#FF0000' red
46 function colour($colour)
48 $this->colour = $colour;
49 return $this;
52 /**
53 * The tooltip for this dot.
55 function tooltip( $tip )
57 $this->tip = $tip;
58 return $this;
61 /**
62 * @param $size is an integer. Size of the dot.
64 function size($size)
66 $tmp = 'dot-size';
67 $this->$tmp = $size;
68 return $this;
71 /**
72 * a private method
74 function type( $type )
76 $this->type = $type;
77 return $this;
80 /**
81 * @param $size is an integer. The size of the hollow 'halo' around the dot that masks the line.
83 function halo_size( $size )
85 $tmp = 'halo-size';
86 $this->$tmp = $size;
87 return $this;
90 /**
91 * @param $do as string. One of three options (examples):
92 * - "http://example.com" - browse to this URL
93 * - "https://example.com" - browse to this URL
94 * - "trace:message" - print this message in the FlashDevelop debug pane
95 * - all other strings will be called as Javascript functions, so a string "hello_world"
96 * will call the JS function "hello_world(index)". It passes in the index of the
97 * point.
99 function on_click( $do )
101 $tmp = 'on-click';
102 $this->$tmp = $do;
107 * Draw a hollow dot
109 class hollow_dot extends dot_base
111 function hollow_dot($value=null)
113 parent::dot_base( 'hollow-dot', $value );
118 * Draw a star
120 class star extends dot_base
123 * The constructor, takes an optional $value
125 function star($value=null)
127 parent::dot_base( 'star', $value );
131 * @param $angle is an integer.
133 function rotation($angle)
135 $this->rotation = $angle;
136 return $this;
140 * @param $is_hollow is a boolean.
142 function hollow($is_hollow)
144 $this->hollow = $is_hollow;
149 * Draw a 'bow tie' shape.
151 class bow extends dot_base
154 * The constructor, takes an optional $value
156 function bow($value=null)
158 parent::dot_base( 'bow', $value );
162 * Rotate the anchor object.
163 * @param $angle is an integer.
165 function rotation($angle)
167 $this->rotation = $angle;
168 return $this;
173 * An <i><b>n</b></i> sided shape.
175 class anchor extends dot_base
178 * The constructor, takes an optional $value
180 function anchor($value=null)
182 parent::dot_base( 'anchor', $value );
186 * Rotate the anchor object.
187 * @param $angle is an integer.
189 function rotation($angle)
191 $this->rotation = $angle;
192 return $this;
196 * @param $sides is an integer. Number of sides this shape has.
198 function sides($sides)
200 $this->sides = $sides;
201 return $this;
206 * A simple dot
208 class dot extends dot_base
211 * The constructor, takes an optional $value
213 function dot($value=null)
215 parent::dot_base( 'dot', $value );
220 * A simple dot
222 class solid_dot extends dot_base
225 * The constructor, takes an optional $value
227 function solid_dot($value=null)
229 parent::dot_base( 'solid-dot', $value );