5 function pie_value( $value, $label )
12 * Sets the text for the line.
16 function set_text($text)
21 function set_key_on_click( $action )
23 $tmp = 'key-on-click';
24 $this->$tmp = $action;
27 function set_colour( $colour )
29 $this->colour
= $colour;
32 function set_label( $label, $label_colour, $font_size )
34 $this->label
= $label;
36 $tmp = 'label-colour';
37 $this->$tmp = $label_colour;
40 $this->$tmp = $font_size;
44 function set_tooltip( $tip )
49 function on_click( $event )
57 * An object that inherits from base_pie_animation
59 function add_animation( $animation )
61 if( !isset( $this->animate
) )
62 $this->animate
= array();
64 $this->animate
[] = $animation;
70 class base_pie_animation
{}
73 * fade the pie slice from $alpha (pie set_alpha) to 100% opaque.
75 class pie_fade
extends base_pie_animation
84 * Bounce the pie slice out a little
86 class pie_bounce
extends base_pie_animation
89 * @param $distance as integer, distance to bounce in pixels
91 function pie_bounce( $distance )
94 $this->distance
= $distance;
99 * Make a pie chart and fill it with pie slices
108 function set_colours( $colours )
110 $this->colours
= $colours;
114 * Sugar wrapped around set_colours
116 function colours( $colours )
118 $this->set_colours( $colours );
123 * @param $alpha as float (0-1) 0.75 = 3/4 visible
125 function set_alpha( $alpha )
127 $this->alpha
= $alpha;
131 *sugar wrapped set_alpha
133 function alpha( $alpha )
135 $this->set_alpha( $alpha );
140 * @param $v as array containing one of
142 * - real or integer number
143 * - a pie_value object
145 function set_values( $v )
151 * sugar for set_values
153 function values( $v )
155 $this->set_values( $v );
160 * HACK to keep old code working.
162 function set_animate( $bool )
165 $this->add_animation( new pie_fade() );
170 * An object that inherits from base_pie_animation
172 function add_animation( $animation )
174 if( !isset( $this->animate
) )
175 $this->animate
= array();
177 $this->animate
[] = $animation;
183 * @param $angle as real number
185 function set_start_angle( $angle )
187 $tmp = 'start-angle';
188 $this->$tmp = $angle;
192 * sugar for set_start_angle
194 function start_angle($angle)
196 $this->set_start_angle( $angle );
201 * @param $tip as string. The tooltip text. May contain magic varibles
203 function set_tooltip( $tip )
209 * sugar for set_tooltip
211 function tooltip( $tip )
213 $this->set_tooltip( $tip );
217 function set_gradient_fill()
219 $tmp = 'gradient-fill';
223 function gradient_fill()
225 $this->set_gradient_fill();
230 * By default each label is the same colour as the slice,
231 * but you can ovveride that behaviour using this method.
233 * @param $label_colour as string HEX colour;
235 function set_label_colour( $label_colour )
237 $tmp = 'label-colour';
238 $this->$tmp = $label_colour;
241 function label_colour( $label_colour )
243 $this->set_label_colour( $label_colour );
248 * Turn off the labels
250 function set_no_labels()
256 function on_click( $event )
259 $this->$tmp = $event;
263 * Fix the radius of the pie chart. Take a look at the magic variable #radius#
264 * for helping figure out what radius to set it to.
266 * @param $radius as number
268 function radius( $radius )
270 $this->radius
= $radius;