Пример #1
0
	/**
	 * Change text of labels
	 *
	 * @param array $texts Some texts
	 */
	public function setLabelText($texts) {
		if(is_array($texts)) {
			$this->auto(FALSE);
			$function = 'axis'.time().'_'.(microtime() * 1000000);
			eval('function '.$function.'($value) {
				$texts = '.var_export($texts, TRUE).';
				return isset($texts[$value]) ? $texts[$value] : \'?\';
			}');
			$this->label->setCallbackFunction($function);
		}
	}
Пример #2
0
 /**
  * Build the plot
  *
  * @param array $values Pie values
  */
 public function __construct($values, $colors = awPie::COLORED)
 {
     $this->setValues($values);
     if (is_array($colors)) {
         $this->colors = $colors;
     } else {
         switch ($colors) {
             case awPie::AQUA:
                 $this->colors = array(new awColor(131, 220, 215), new awColor(131, 190, 215), new awColor(131, 160, 215), new awColor(160, 140, 215), new awColor(190, 131, 215), new awColor(220, 131, 215));
                 break;
             case awPie::EARTH:
                 $this->colors = array(new awColor(97, 179, 110), new awColor(130, 179, 97), new awColor(168, 179, 97), new awColor(179, 147, 97), new awColor(179, 108, 97), new awColor(99, 107, 189), new awColor(99, 165, 189));
                 break;
             case awPie::DARK:
                 $this->colors = array(new awColor(140, 100, 170), new awColor(130, 170, 100), new awColor(160, 160, 120), new awColor(150, 110, 140), new awColor(130, 150, 160), new awColor(90, 170, 140));
                 break;
             default:
                 $this->colors = array(new awColor(187, 213, 151), new awColor(223, 177, 151), new awColor(111, 186, 132), new awColor(197, 160, 230), new awColor(165, 169, 63), new awColor(218, 177, 89), new awColor(116, 205, 121), new awColor(200, 201, 78), new awColor(127, 205, 177), new awColor(205, 160, 160), new awColor(190, 190, 190));
                 break;
         }
     }
     parent::__construct();
     $this->label = new awLabel();
     $this->label->setCallbackFunction('callbackPerCent');
 }