PHP Classes

File: demo.php

Recommend this page to a friend!
  Classes of Sheldon Kennedy   NanoChart   demo.php   Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: Example script
Class: NanoChart
Outputs a pie chart from a values array
Author: By
Last change:
Date: 1 month ago
Size: 417 bytes
 

Contents

Class file image Download
<?php

require 'src/NanoChart.php';

$items = [
   
'Monday' => 10,
   
'Tuesday' => 20,
   
'Wednesday' => 30
];

$palette = [
   
'hsl(355, 90%, 65%)',
   
'hsl(37, 100%, 70%)',
   
'hsl(140, 70%, 65%)'
];

$nanoChart = new NanoChart($counts);
$nanoChart->setSize(250);
$nanoChart->setDirection('row');
$nanoChart->setStyle('doughnut');
$nanoChart->setPalette($palette);
$chart = $nanoChart->build();

echo
$chart;