Sparklines with Javascript and Canvas
About a month ago, when the new Firefox beta was released, I decided to play around with the brand-spanking new Canvas element, which is going into HTML 5. Currently Mozilla, Safari, and Opera 9 all support it - which is a good sign. Essentially, this element allows you to do 2D graphics (drawing lines, rotating images, etc.) - which is great for doing some more 'intense' web applications.
The first thing I decided to implement was a simple Javascript Sparklines library. All it does is run through your HTML, look for your embedded Sparklines, and replace them with pretty little charts - it even scales them appropriately. It's completely unobtrusive so a simple call in the header of your HTML file should be sufficient to run it. For more information, and a snazzy demo, visit the project page.
Tags: canvas, sparklines, programming, javascript, firefox
4 Comments on 'Sparklines with Javascript and Canvas'



