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 · Tags: canvas, sparklines, programming, javascript, firefox

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.


JavaScript Books

Secrets of the JavaScript Ninja

JavaScript Secrets

Secret techniques of top JavaScript programmers. Coming Fall 2009.

Pro JavaScript Techniques

Pro JavaScript

The best techniques for professional JavaScript. Published by Apress.

Micro Updates

John Resig Twitter Updates

@jeresig

Infrequent, short, updates and links.

JavaScript Jobs



Hosting provided by: Ruby Hosting by Engine Yard