"rgba(220,220,220,0.5)", 'strokeColor' => "rgba(220,220,220,1)", 'pointColor ' => "rgba(220,220,220,1)", 'pointStrokeColor' => "#fff", 'data' => array(65,59,90,81,56,55,40) ); $data['datasets'][] = array( 'fillColor' => "rgba(151,187,205,0.5)", 'strokeColor' => "rgba(151,187,205,1)", 'pointColor ' => "rgba(151,187,205,1)", 'pointStrokeColor' => "#fff", 'data' => array(28,48,40,19,96,27,100) ); $cht = e107::getChart(); $cht->setType('line'); $cht->setData($data,'canvas'); echo $cht->render('canvas'); */ class e_chart { protected $id; protected $data = null; protected $type = 'line'; function __construct() { e107::js('core','chart/Chart.min.js','jquery'); e107::css('inline','canvas.e-graph { width: 100% !important; max-width: 800px; height: auto !important; }'); } private function getData() { return json_encode($this->data); } /** * Set the type of graph * @param string $type - line | bar | pie | radar | doughnut | polar */ public function setType($type) { $this->type = $type; return $this; } /** * Set the data values * @param array $data * @param string $id of canvas element */ public function setData($data,$id) { $this->id = $id; $this->data = $data; return $this; } /** * Render Graph * @param string $id of canvas * @param integer $width * @param integer $height * @return null */ public function render($id, $width=800,$height=300) { if($this->data == null) { return "