5 function pie_value( $value, $label )
11 function set_colour( $colour )
13 $this->colour
= $colour;
16 function set_label( $label, $label_colour, $font_size )
18 $this->label
= $label;
20 $tmp = 'label-colour';
21 $this->$tmp = $label_colour;
24 $this->$tmp = $font_size;
28 function set_tooltip( $tip )
33 function on_click( $event )
41 * An object that inherits from base_pie_animation
43 function add_animation( $animation )
45 if( !isset( $this->animate
) )
46 $this->animate
= array();
48 $this->animate
[] = $animation;
54 class base_pie_animation
{}
57 * fade the pie slice from $alpha (pie set_alpha) to 100% opaque.
59 class pie_fade
extends base_pie_animation
68 * Bounce the pie slice out a little
70 class pie_bounce
extends base_pie_animation
73 * @param $distance as integer, distance to bounce in pixels
75 function pie_bounce( $distance )
78 $this->distance
= $distance;
83 * Make a pie chart and fill it with pie slices
92 function set_colours( $colours )
94 $this->colours
= $colours;
98 * Sugar wrapped around set_colours
100 function colours( $colours )
102 $this->set_colours( $colours );
107 * @param $alpha as float (0-1) 0.75 = 3/4 visible
109 function set_alpha( $alpha )
111 $this->alpha
= $alpha;
115 *sugar wrapped set_alpha
117 function alpha( $alpha )
119 $this->set_alpha( $alpha );
124 * @param $v as array containing one of
126 * - real or integer number
127 * - a pie_value object
129 function set_values( $v )
135 * sugar for set_values
137 function values( $v )
139 $this->set_values( $v );
144 * HACK to keep old code working.
146 function set_animate( $bool )
149 $this->add_animation( new pie_fade() );
154 * An object that inherits from base_pie_animation
156 function add_animation( $animation )
158 if( !isset( $this->animate
) )
159 $this->animate
= array();
161 $this->animate
[] = $animation;
167 * @param $angle as real number
169 function set_start_angle( $angle )
171 $tmp = 'start-angle';
172 $this->$tmp = $angle;
176 * sugar for set_start_angle
178 function start_angle($angle)
180 $this->set_start_angle( $angle );
185 * @param $tip as string. The tooltip text. May contain magic varibles
187 function set_tooltip( $tip )
193 * sugar for set_tooltip
195 function tooltip( $tip )
197 $this->set_tooltip( $tip );
201 function set_gradient_fill()
203 $tmp = 'gradient-fill';
207 function gradient_fill()
209 $this->set_gradient_fill();
214 * By default each label is the same colour as the slice,
215 * but you can ovveride that behaviour using this method.
217 * @param $label_colour as string HEX colour;
219 function set_label_colour( $label_colour )
221 $tmp = 'label-colour';
222 $this->$tmp = $label_colour;
225 function label_colour( $label_colour )
227 $this->set_label_colour( $label_colour );
232 * Turn off the labels
234 function set_no_labels()
240 function on_click( $event )
243 $this->$tmp = $event;
247 * Fix the radius of the pie chart. Take a look at the magic variable #radius#
248 * for helping figure out what radius to set it to.
250 * @param $radius as number
252 function radius( $radius )
254 $this->radius
= $radius;