Previous: Preparing for print
Next: Rich Text Editor V something else

Canvas Based Bar Graph

Note: Click here for the follow on to this article.

I recently wrote about how I'd modified a great example of creating a pie chart using the canvas tag and javascript. I've now written a bar graphing function based on the same principal of dynamically building the chart from tabulated data and building it to the size of the canvas tag.

This will form part of a charting component I'm writing, and although this example only builds a simple bar graph, the finished product will let you compare multiple bar values, plot trend lines, line graphs and scatter graphs. It's just a matter of doing it and making it more flexible.

I'll upload the source code once I've streamilined it a bit, the features are:

  • Dynamically builds background and adjusts based on canvas size. tiny or full screen the proportions of the graph are retained.
  • Positions values dynamically.
  • Builds dynamically from tabulated data.

Source should be up later in the week, good night all.

 

 

Comments

No comments have been added.

Add a comment

0 comments

Latest Tweets

  • @CaiGriffiths This in on a par with Lou Reed being penalised for shouting at someone. Crazy. So tThumping tackles being outlawed

  • RIP Corey Haim

  • RT @nineplanfailed: New show announced in Cardiff at Tommy's Bar on March 10, 2010 http://lnk.ms/6z2rq

  • Spent 10 minutes on databases and 30 minutes inventing / playing google analytics top trumps

  • Teaching databases to a boy with autism. We're both enjoying.

Follow Me