ofc_pie.php 1.48 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
<?php

class pie_value
{
	function pie_value( $value, $label )
	{
		$this->value = $value;
		$this->label = $label;
	}
	
	function set_colour( $colour )
	{
		$this->colour = $colour;
	}
	
	function set_label( $label, $label_colour, $font_size )
	{
		$this->label = $label;
		
		$tmp = 'label-colour';
		$this->$tmp = $label_colour;
		
		$tmp = 'font-size';
		$this->$tmp = $font_size;
		
	}
	
	function set_tooltip( $tip )
	{
		$this->tip = $tip;
	}
	
	function on_click( $event )
	{
		$tmp = 'on-click';
		$this->$tmp = $event;
	}

}

class pie
{
	function pie()
	{
		$this->type      		= 'pie';
		$this->colours     		= array("#d01f3c","#356aa0","#C79810");
		$this->border			= 2;
	}
	
	function set_colours( $colours )
	{
		$this->colours = $colours;
	}
	
	function set_alpha( $alpha )
	{
		$this->alpha = $alpha;
	}
	
	function set_values( $v )
	{
		$this->values = $v;		
	}
	
	// boolean
	function set_animate( $animate )
	{
		$this->animate = $animate;
	}
	
	// real
	function set_start_angle( $angle )
	{
		$tmp = 'start-angle';
		$this->$tmp = $angle;
	}
	
	function set_tooltip( $tip )
	{
		$this->tip = $tip;
	}
	
	function set_gradient_fill()
	{
		$tmp = 'gradient-fill';
		$this->$tmp = true;
	}
	
	function set_label_colour( $label_colour )
	{
		$tmp = 'label-colour';
		$this->$tmp = $label_colour;	
	}
	
	/**
	 * Turn off the labels
	 */
	function set_no_labels()
	{
		$tmp = 'no-labels';
		$this->$tmp = true;
	}
	
	function on_click( $event )
	{
		$tmp = 'on-click';
		$this->$tmp = $event;
	}
}