PHP code example of samchristy / piechart

1. Go to this page and download the library: Download samchristy/piechart library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

samchristy / piechart example snippets



amChristy\PieChart\PieChartGD;

$chart = new PieChartGD(600, 375);

$chart->setTitle('Browser Usage Statistics (January - April)');
// Method chaining coming soon!
$chart->addSlice('Google Chrome',   27, '#4A7EBB');
$chart->addSlice('Mozilla Firefox', 23, '#DA8137');
$chart->addSlice('Apple Safari',    11, '#9BBB59');
$chart->addSlice('Opera',            3, '#BE4B48');
$chart->addSlice('Other',            5, '#7D60A0');

$chart->draw();
$chart->outputPNG();