Part of the EllisLab Network
x
 
Create New Page
 View Previous Changes    ( Last updated by wiredesignz )

3d-pie-chart

Category:Controller -> Charts | Category:Controller -> Community

3D Pie Chart Library

This library is an implementation of the Script to 3D pie chart with PHP by Rasmus Petersen - all credits go to him.

My changes
* Accepts data and labels as arrays
* Allows TTF fonts in the labels (optional)
* Handles direct stream output or save to file

Requirements

* GD 2.0.1 or later
* PNG Support

Output

7116524b47f38524baa6b30d49a89ec2

Controller

$this->load->library('piechart');

// Set variables etc
$this->piechart->showLabel(true);
$this->piechart->showPercent(true);
$this->piechart->showParts(true);
$this->piechart->setWidth(250);
$this->piechart->setFont('c:/wamp/www/classroombookings/tahoma.ttf', 9);
$this->piechart->setLegend('round');
$this->piechart->setData( array(14,5,11,10,20) );
$this->piechart->setLabels( array('Room 14','ICT Suite','Room 13','Study Centre','Technology Suite') );

// Make unique filename
$hash = md5("report-pie-".$this->school_id);

// Generate pie and save it
$this->piechart->Generate("webroot/images/reports/$hash.png");
        
$layout['title'] = 'Reports';
$layout['showtitle'] = $layout['title'];
$layout['body'] = $this->load->view('reports/reports_index', NULL, True);
$layout['body'] .= '<img src="webroot/images/reports/'.$hash.'.png">';
        
$this->load->view('layout', $layout);

Download

File:Piechart.zip