This site is a low down on what's going on in my life, what I'm working on, what I'm thinking about, and how I'm feeling about life in general.

Sunday, 13 April 2008 21:25

Canvas Based Bar Graph

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.

Screenshot of my bar graph solution

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.



Posted in categories:

Tags: Javascript HTML Canvas Charting Chart Bar Graph Bar-Graph Component Free Source Code

Comments

    Add a comment

    Most Read Articles