cogitatio / sparkline
Generating sparkline SVGs
Installs: 1 452
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 3
pkg:composer/cogitatio/sparkline
Requires
- php: >=5.3.0
Requires (Dev)
- satooshi/php-coveralls: dev-master
This package is not auto-updated.
Last update: 2025-12-20 21:33:02 UTC
README
Basic usage
<?php use Cogitatio\Sparkline\Sparkline; $values = [ 3, 4, 5, 6, 12, 90, 1, 0, 0 ]; $sparkline = new Sparkline(100, 100); // Add a dataset $sparkline->addDataSet($values, 'nrOfUsers'); // decide how to show it: $sparline->addSpark('line', array('nrOfUsers')); // other posiblities: $sparline->addSpark('percentShift', array('nrOfUsers')); $sparline->addSpark('difference', array('nrOfUsers')); // Then render the svg element somewhere on your page: echo $sparkline->render();
Styling
Example css style:
.line { fill: none; stroke: black; stroke-width: 1px; } .blueline { stroke: #2222ff; } .above { fill: #00aa00; stroke: none;} .below { fill: #ff0000; stroke: none;}