View/Helper/TaskHelper.php
public function statistics(array $statistics) {
		if ($this->_isCli) {
			return $this->_none('Not allowed in cli');
		}
		if (!$this->settings['chartEnabled']) {
			return $this->_none('Please install <b>imsamurai/cakephp-google-chart</b> plugin to view graph');
		}
		if (empty($statistics)) {
			return $this->_none();
		}
		
		$this->GoogleChart->load();

		$chartData = $this->GoogleChart->dataFromArray(array(
			'memory' => array_map('floatval', Hash::extract($statistics, '{n}.memory')),
			'cpu' => array_map('floatval', Hash::extract($statistics, '{n}.cpu')),
			'date' => array_map('strtotime', Hash::extract($statistics, '{n}.created')),
			'statistics' => $statistics
				), array(
			'date' => array(
				'v' => 'date.{n}',
				'f' => 'statistics.{n}.created'
			),
			'memory' => 'memory.{n}',
			'cpu' => 'cpu.{n}',
			'{"role": "annotation"}' => 'statistics.{n}.status',
				)
		);

		return $this->GoogleChart->draw('LineChart', $chartData, array(
			'height' => 300,
			'width' => 800,
			'pointSize' => 5,
			'vAxis' => array(
				'title' => 'Percentage'
			),
			'hAxis' => array(
				'title' => 'Time'
			),
			'chartArea' => array(
				'left' => 50,
				'top' => 10,
				'height' => 230,
				'width' => 650,
			)
				)
		);
	}
public function statistics(array $statistics) {
		if ($this->_isCli) {
			return $this->_none('Not allowed in cli');
		}
		if (!$this->settings['chartEnabled']) {
			return $this->_none('Please install <b>imsamurai/cakephp-google-chart</b> plugin to view graph');
		}
		if (empty($statistics)) {
			return $this->_none();
		}
		
		$this->GoogleChart->load();

		$chartData = $this->GoogleChart->dataFromArray(array(
			'memory' => array_map('floatval', Hash::extract($statistics, '{n}.memory')),
			'cpu' => array_map('floatval', Hash::extract($statistics, '{n}.cpu')),
			'date' => array_map('strtotime', Hash::extract($statistics, '{n}.created')),
			'statistics' => $statistics
				), array(
			'date' => array(
				'v' => 'date.{n}',
				'f' => 'statistics.{n}.created'
			),
			'memory' => 'memory.{n}',
			'cpu' => 'cpu.{n}',
			'{"role": "annotation"}' => 'statistics.{n}.status',
				)
		);

		return $this->GoogleChart->draw('LineChart', $chartData, array(
			'height' => 300,
			'width' => 800,
			'pointSize' => 5,
			'vAxis' => array(
				'title' => 'Percentage'
			),
			'hAxis' => array(
				'title' => 'Time'
			),
			'chartArea' => array(
				'left' => 50,
				'top' => 10,
				'height' => 230,
				'width' => 650,
			)
				)
		);
	}
public function statistics ( array $ statistics ) { if ( $ this -> _isCli ) { return $ this -> _none ( 'Not allowed in cli' ) ; } if ( ! $ this -> settings [ 'chartEnabled' ] ) { return $ this -> _none ( 'Please install <b>imsamurai/cakephp-google-chart</b> plugin to view graph' ) ; } if ( empty ( $ statistics ) ) { return $ this -> _none ( ) ; } $ this -> GoogleChart -> load ( ) ; $ chartData = $ this -> GoogleChart -> dataFromArray ( array ( 'memory' => array_map ( 'floatval' , Hash :: extract ( $ statistics , '{n}.memory' ) ) , 'cpu' => array_map ( 'floatval' , Hash :: extract ( $ statistics , '{n}.cpu' ) ) , 'date' => array_map ( 'strtotime' , Hash :: extract ( $ statistics , '{n}.created' ) ) , 'statistics' => $ statistics ) , array ( 'date' => array ( 'v' => 'date.{n}' , 'f' => 'statistics.{n}.created' ) , 'memory' => 'memory.{n}' , 'cpu' => 'cpu.{n}' , '{"role": "annotation"}' => 'statistics.{n}.status' , ) ) ; return $ this -> GoogleChart -> draw ( 'LineChart' , $ chartData , array ( 'height' => 300 , 'width' => 800 , 'pointSize' => 5 , 'vAxis' => array ( 'title' => 'Percentage' ) , 'hAxis' => array ( 'title' => 'Time' ) , 'chartArea' => array ( 'left' => 50 , 'top' => 10 , 'height' => 230 , 'width' => 650 , ) ) ) ; }
Make statistics graph

@param array $statistics
@return string
Make statistics graph