├── composer.json
├── LICENSE.md
├── README.md
└── sparkline.php
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jamiebicknell/Sparkline",
3 | "description": "PHP script to generate sparklines",
4 | "keywords": [
5 | "sparkline",
6 | "sparklines",
7 | "php",
8 | "gd"
9 | ],
10 | "homepage": "http://github.com/jamiebicknell/Sparkline",
11 | "license": "MIT",
12 | "authors": [
13 | {
14 | "name": "Jamie Bicknell",
15 | "homepage": "http://www.jamiebicknell.com"
16 | }
17 | ],
18 | "require": {
19 | "php": ">=5.2.0"
20 | }
21 | }
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Jamie Bicknell - @jamiebicknell
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Sparkline
2 |
3 | PHP script to generate sparklines, with browser cachine with ETag.
4 |
5 | ## Usage
6 |
7 | ```html
8 |
9 | ```
10 |
11 | ## Examples
12 |
13 |

14 | `sparkline.php`
15 |
16 | 
17 | `sparkline.php?data=5`
18 |
19 | 
20 | `sparkline.php?data=2,4,5,6,10,7,8,5,7,7,11,8,6,9,11,9,13,14,12,16`
21 |
22 | 
23 | `sparkline.php?data=2,4,5,6,10,7,8,5,7,7,11,8,6,9,11,9,13,14,12,16&line=5bb763&fill=d5f7d8`
24 |
25 | 
26 | `sparkline.php?data=2,4,5,6,10,7,8,5,7,7,11,8,6,9,11,9,13,14,12,16&line=fd8626&fill=ffedde`
27 |
28 | 
29 | `sparkline.php?data=2,4,5,6,10,7,8,5,7,7,11,8,6,9,11,9,13,14,12,16&line=ed5565&fill=ffe2e2`
30 |
31 | 
32 | `sparkline.php?data=2,4,5,6,10,7,8,5,7,7,11,8,6,9,11,9,13,14,12,16&line=444&fill=eee`
33 |
34 | 
35 | `sparkline.php?data=2,4,5,6,10,7,8,5,7,7,11,8,6,9,11,9,13,14,12,16&line=31475c&fill=fff`
36 |
37 | 
38 | `sparkline.php?size=185x40&data=2,4,5,6,10,7,8,5,7,7,11,8,6,9,11,9,13,14,12,16`
39 |
40 |
41 | ## Query Parameters
42 |
43 |
| Key | 46 |Example Value | 47 |Default | 48 |Description | 49 |
|---|---|---|---|
| size | 52 |100x25, 100 | 53 |80x20 | 54 |Width must be between 50 and 80 Height must be between 20 and 800 |
55 |
| data | 58 |10,20,50,20,30,40,50,120,90 | 59 |60 | | Comma separated list of values to plot | 61 |
| back | 64 |eeeeee, ddd | 65 |ffffff | 66 |Hexadecimal code for background colour | 67 |
| line | 70 |555555, 222 | 71 |1388db | 72 |Hexadecimal code for line colour | 73 |
| fill | 76 |cccccc, bbb | 77 |e6f2fa | 78 |Hexadecimal code for fill colour | 79 |
| Value | 87 |Description | 88 |
|---|---|
| 100 | 91 |Creates a square image 100px in width and 100px in height | 92 |
| 80x20 | 95 |Creates an image 80px in width and 20px in height | 96 |