Building a bar chart in Flash, part 1
I get a lot of queries from people about how to create charts in Flash. Flash MX shipped with some chart components and there are a number of commercial products available that can help you make charts. However, if you need to make a simple chart, you can quite easily write your own. That’s the topic for this tutorial.
In this tutorial, I’ll show you how to create your own reusable BarChart class. We’ll draw the axes and bars with the drawing API. We’ll allow users of the class to create it with default values and labels or set their own. We’ll also allow people to add their own title and bar colour. If you’re not familiar with the drawing API, I won’t cover it in detail here so if you need a refresher, check out the Drawing with Flash article.
Note: If you have difficulties downloading the source files or PDF, you might have a problem with your cookies. Delete the cookies from your machine and try again. In Internet Explorer, you can do this by choosing Tools > Internet Options… and clicking the Delete Cookies… button on the General tab.