November 2011
Intermediate to advanced
348 pages
7h 2m
English
Right behind pie charts, bar charts are another popular tool for visualizing data. In this recipe, we'll create a configurable Bar Chart class that takes in an array of data elements and creates a simple bar chart. We'll reuse the data structure from the previous recipe to compare the results. Like the Pie Chart class, the bar chart drawing methods also automatically scale the chart to fill up the canvas.

Follow these steps to create a Bar Chart class that can automatically position and size a bar chart from an array of data:
BarChart constructor which draws the chart:/* * BarChart constructor */ function ...
Read now
Unlock full access