2017 © Pedro Peláez
 

library sparkline

Generating sparkline SVGs

image

cogitatio/sparkline

Generating sparkline SVGs

  • Thursday, February 20, 2014
  • by cogitatio
  • Repository
  • 1 Watchers
  • 3 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 6 % Grown

The README.md

sparkline

Build Status Coverage Status, (*1)

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:, (*2)

    .line {
          fill: none;
            stroke: black;
              stroke-width: 1px;
    }
    .blueline {
        stroke: #2222ff;
    }
    .above { fill: #00aa00; stroke: none;}
    .below { fill: #ff0000; stroke: none;}

The Versions

20/02 2014

dev-master

9999999-dev http://github.com/cogitatio/sparkline

Generating sparkline SVGs

  Sources   Download

GPL2

The Requires

  • php >=5.3.0

 

The Development Requires

svg sparkline