Download the PHP package fundevogel/tiny-phpeanuts without Composer
On this page you can find all versions of the php package fundevogel/tiny-phpeanuts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fundevogel/tiny-phpeanuts
More information about fundevogel/tiny-phpeanuts
Files in fundevogel/tiny-phpeanuts
Package tiny-phpeanuts
Short Description A tiny PHP library for creating SVG donut (and pie) charts.
License MIT
Homepage https://github.com/Fundevogel
Informations about the package tiny-phpeanuts
tiny-phpeanuts
A tiny PHP library for creating SVG donut (and pie) charts.
What
This library is a PHP port of the TypeScript library tiny-donuts
.
Why
We needed Donut charts - however, Chart.js was a much too powerful (and big) for our use case and added >200kb to our browser application.
So we wrote this small library with a minified size of 4 KiB.
While tiny-donuts
is a great library, we needed something less client-side and more server-side.
So we ported their library to PHP.
How
Install this package with Composer:
Configuration
The Donut
class takes three parameters:
Parameter | Type | Default | Description |
---|---|---|---|
$entries |
array | - | data to be visualized |
$thickness |
float | see below | thickness of the chart |
$spacing |
float | see below | spacing between the segments |
Options
.. and there's even more! Check out these 'global' options:
Setter | Type | Default | Description |
---|---|---|---|
setSize |
int | 100 |
dimensions of chart |
setBackgroundColor |
string | 'transparent' |
background fill color |
setPreferViewbox |
bool | true |
viewBox > width & height |
setClasses |
string | '' |
classes applied to chart |
setRole |
string | 'img' |
role attribute |
setPieChart |
bool | false |
make it a pie chart |
Example
.. looks like this:
.. and with setPieChart(true)
:
FAQ
Will there be more charts in the future?
PRs welcome, beyond that .. no.
Are you sure?
Yes! If you are looking for something more serious, have a look at easychart.
Roadmap
- [ ] Add tests
- [x] Table view for options
- [x] Optimizing code
Credits
This project is based on the TypeScript library tiny-donuts
by Kim Almasan & Lars Krumbier. The helper functions (see lib/helpers
) were taken from Kirby by Bastian Allgeier (both the project and its founder are just awesome, btw).
Happy coding!
:copyright: Fundevogel Kinder- und Jugendbuchhandlung