Initial release of hsparklines 0.1.0
posted by hitesh on 2008-02-27
I've put the first release of hsparklines up on Hackage. It's a sparklines library implemented in Haskell. I know there are a number of web service based solutions that one could use for this, but for those who've used web services, you know that there are some things you want to keep local.
If you haven't played with sparklines yet, you should. They're minigraphs inspired by Edward Tufte to present a large amount of contextual information in a minimum of space. For example, here's a sparkline that shows the number of uploads to Hackage by month.
It hardly takes up any space, yet quickly communicates how well the Haskell community is growing and contributing a good amount of code.
Install
Download the tarball from Hackage and extract it into a directory. Go into the directory and run configure, build, haddock (optional) and install.
% tar zxvf hsparklines-0.1.0.tar.gz % cd hsparklines-0.1.0 % runhaskell Setup.lhs configure % runhaskell Setup.lhs build % runhaskell Setup.lhs haddock -- optional step if you want local docs % sudo runhaskell Setup.lhs install
Usage
First of all you're going to need some data. We'll assume you acquired some from whatever means necessary. With the first release, we can generate smooth sparklines
and bar sparklines
using the following code as an example. See the examples directory in the distribution for more examples.
import Graphics.Rendering.HSparklines
dp :: [Float]
dp = [13.4, ... ]
main :: IO ()
main = make smoothSpark dp >>= savePngFile "dummy.png"
data uris
You can also generate a base64 encoding of the image to use in a data uri.
make smoothSpark dp >>= encodePngAsDataUrl >>= putStrLn
Additional Resources
Referrers
- http://haskell.org/haskellwiki/Hackage_statistics
- http://cgi.cse.unsw.edu.au/~dons/blog/2008/06/24
- http://cgi.cse.unsw.edu.au/~dons/blog
- http://www.google.com/reader/view/
- http://search.live.com/results.aspx?q=hsparklines&mrt=en-us&FORM=LIVSOP
- http://planet.haskell.org/
- http://search.live.com/results.aspx?q=hsparklines&form=QBHP
- http://cgi.cse.unsw.edu.au/~dons/blog/
- http://cgi.cse.unsw.edu.au/~dons/blog/2008/06
- http://search.live.com/results.aspx?q=hsparklines
About
Hitesh wrote his first program on a punch card in 1979 ... he's been debugging it ever since.
Very Cool! I like this!
This is incredibly useful for me. Thanks for the hackage upload!