Dynamic Javascript Chart Plotting With PlotKit

Technology
Dynamic Javascript Chart Plotting With PlotKit

plotkit_20070418.jpg
PlotKit is a slick javascript library that allows you to easily generate line, bar, and pie charts with a few lines of javascript code. It supports rendering to both Canvas and SVG, so you can use it to add charting to your application and still be able to support a fair amount of browsers.

I’m glossing over some of the more advanced features, but check out how easy it is to generate a simple graph:


var data = [[0,0], [1,2], [2,3], [3, 7], [4, 8], [5, 6]];
var plotter = EasyPlot("line", {}, $("example"), [data]);

That will plot the values from the “data” array and display it in a div with the ID “example”. Cool, no?

Charting from javascript is interesting, because it allows you to link in to data APIs that are provided by other services. There’s a link below to a tool that will pull in data from a published Google Spreadsheet and generate the necessary javascript to display widget graphs on another site. It reminds me of how you can pull Excel graphs into a Word document, except javascript is the new, better OLE. With output tools like PlotKit, online services like Google Spreadsheets, and open data APIs in between, there are just so many possibilities now for creating information that can be shared in a variety of formats.

4 thoughts on “Dynamic Javascript Chart Plotting With PlotKit

  1. thematrix says:

    it is not working in internet explorer, any ideas to make it work?

  2. BillyG_n_SC says:

    I got it working at http://www.billy-girlardo.com/Maps/Greenville_SC/Crime/TotalCrimeSceneCalls.html in IE6 with this as the very first line (before the DOCTYPE):

    ?xml version=”1.0″ encoding=”UTF-8″?

    I don’t have it working in IE7 yet though, but neither does the demo from the site itself, so it’s gonna take some conditional statements prolly.

Comments are closed.

Tagged
Send this to a friend
FEEDBACK