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