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.

Posted: November 12th, 2005


Subscribe for email updates

4 Comments (Show Comments)



Comments are closed.
Comments are automatically turned off two weeks after the original post. If you have a question concerning the content of this post, please feel free to contact me.


Secrets of the JavaScript Ninja

Secrets of the JS Ninja

Secret techniques of top JavaScript programmers. Published by Manning.

John Resig Twitter Updates

@jeresig / Mastodon

Infrequent, short, updates and links.