Frequently Asked Questions
What software is required to run this library?
Sparkline requires PHP 4.0.6 or newer (including PHP 5) and GD 2.0 built as a PHP module. It may be possible to run the library with older versions of GD, however this is not tested or supported.
Where can I get help using this library?
We're light on documentation at the moment, but happy to help. You can submit bugs, feature requests, or ask questions on our low-traffic mailing list on SourceForge.net. The wiki is also a good place to ask for and provide help.
Aren't there existing PHP graphing packages that will generate sparklines? Why write your own?
In theory, any PHP graphing package should be able to generate a sparkline. In practice, however, many of these libraries are written with assumptions about the size of graphs they're going to produce. Simple rules about how to space tick marks on axes and what amount of padding belongs around graph elements begin to break down when the entire graph is 100x15 pixels.
How are the examples on the front page generated?
Each front page example can be found in the 'samples' directory of the distribution. They're also available for perusal in CVS.
What's the difference between low and high-res modes?
Low resolution mode is a simple two-color line drawing - very fast, not very pretty on a small image. High resolution mode uses a bit of trickery to make a very small graph appear highly detailed. Rather than try to render the image elegantly at low resolution (I'm not that smart), Sparkline first renders the image at a high resolution and resamples it into a small space. The resampling process incurs a significant performance penalty.
How fast is image rendering?
Fast enough? On an aging PIII-933 system with recent versions of PHP and Apache, a low-res stock chart with roughly 1300 data points renders in 0.05 seconds. The same chart in high-res mode renders about 6 times slower, roughly 0.3 seconds. It's a trivial matter to add image caching for high-load applications.
Are there other sparkline libraries?
There has been work done on Flash and SVG sparklines. A thread on Edward Tufte's site lists some other print and web implementations. There's also a page on sparklines on Wikipedia. If anyone is aware of other libraries or solutions, please let me know.
Why didn't you use Flash / Java / ASP / SVG / ...?
PHP has a tremendous install base and PHP with GD enjoys broad support for web image generation. I'm also partial to a solution that puts the burden of installing software on the image provider rather than the client. That said, Flash in particular would make an excellent sparkline generator for some uses. If anyone is interested in building a parallel Flash sparkline implementation in this project, please let me know.
How do I contact the author?
jbyers@users.sf.net or various other methods
| Copyright 2010 James Byers - Sparkline is hosted on SourceForge.net and Wikispaces |