| Recommend this page to a friend! |
| Info | Example | Demos | Screenshots | Reputation | Support forum | Blog | Links |
| Ratings | Unique User Downloads | Download Rankings | ||||
| Not yet rated by the users | Total: 12 | All time: 11,474 This week: 42 | ||||
| Version | License | PHP version | Categories | |||
| nanochart 1.0.0 | MIT/X Consortium ... | 7.4 | HTML, Graphics, PHP 7 |
| Description | Author | ||||||||||||||||||||||
This package outputs a pie chart from a values array. |
| ||||||||||||||||||||||
https://youtu.be/hplH_LyNPwI
https://github.com/LuniaStudio/NanoChart
<?php |
This PHP class builds a simple pie or doughnut chart as an SVG with a text legend.

Prepare an associative array of names and amounts:
$items = [
'Monday' => 10,
'Tuesday' => 20,
'Wednesday' => 30
];
Instantiate NanoChart and pass in the array:
$nanoChart = new NanoChart($items);
Customise with setters:
$nanoChart->setSize(250); // width and height in pixels
$nanoChart->setDirection('column'); // CSS flexbox direction options
$nanoChart->setStyle('doughnut'); // change from a basic pie chart to a doughnut chart
$nanoChart->setHue(150); // set the hue value for the colour palette
$nanoChart->setPalette($palette); //pass in a simple array of colours to use for the items
See examples.php for different ways the class can be used.
Requires PHP 7.4 or later.
This project is licensed under the MIT License.
Feel free to contribute, report issues, or suggest improvements!
| Screenshots (1) | ||
| File | Role | Description | ||
|---|---|---|---|---|
| Example | Example script | |||
| Example | Example script | |||
| Lic. | License text | |||
| Doc. | Documentation | |||
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
| Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
| 100% |
|
|
| Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.