Download the PHP package fundevogel/kirby3-charts without Composer
On this page you can find all versions of the php package fundevogel/kirby3-charts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fundevogel/kirby3-charts
More information about fundevogel/kirby3-charts
Files in fundevogel/kirby3-charts
Package kirby3-charts
Short Description SVG charts for Kirby v3
License MIT
Homepage https://codeberg.org/fundevogel/kirby3-charts
Informations about the package kirby3-charts
kirby3-charts
A Kirby v3 plugin for creating SVG charts - batteries included.
What
kirby3-charts
is a Kirby v3 wrapper for SVGGraph
, as such there are (almost) no limits to what kind of chart may be created.
How
Install this package with Composer:
Usage
In order to generate a chart, we need some data first. The page method toChart()
accepts an array of data points as first argument - basically two or more arrays, each of which consists of color
(string) and share
(float):
There's also a field method toChart()
suitable for structure fields. The included example blueprint fields/chart
is a good starting point & looks basically like this:
Both methods take another two arrays for further customization:
Note: Both methods return a file object of the newly created SVG chart (unless inline
is activated) for further use.
Configuration
You may also change certain fallback options from your config.php
globally ('fundevogel.charts.optionName'
):
Option | Type | Default | Description |
---|---|---|---|
'type' |
string | DonutGraph |
Default chart type to be created |
'template' |
string | chart |
Default file template |
'width' |
int | 100 |
SVG canvas width |
'height' |
int | 100 |
SVG canvas height |
'precision' |
int | 2 |
Rounding precision (-1 = off) |
'inline' |
bool | false |
Return SVG string insead of File |
Example
Adding more items to the example $data
from before and using above code, the generated chart looks like this:
Credits
This library is powered by SVGGraph
, an extensive library for creating SVG charts, written by goat1000.
License
kirby3-charts
is licensed under the buy a license.
Happy coding!
All versions of kirby3-charts with dependencies
getkirby/composer-installer Version ^1.2.0
goat1000/svggraph Version ^3.14.0
kschu91/largest-remainder-method Version ^1.1.0