Initial release of hsparklines 0.1.0

Update: Source code is available on github.

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. Hackage uploads by month from 9/2006 to 2/2008 It hardly takes up any space, yet quickly communicates how well the Haskell community is growing and contributing a good amount of code.


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


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 smooth sparkline of dummy data and bar sparklines bar sparkline of dummy data 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

Previous Comments

Very Cool! I like this!

Shae Erisson

This is incredibly useful for me. Thanks for the hackage upload!



comments powered by Disqus