Ged Mead

Ged Mead (XTab) has been around computers since the 1980's when the first affordable home computers came on the market. His journey from that very first Dragon 32 to the present has taken him through many different facets of the IT Industry. These include formal training as a Systems Analyst, employment in a mainframe software development environment, and a short time spent demonstrating rugged military IT systems in the days when it took two strong men to carry a 'mobile' system.
His most rewarding challenge was the creation of a financial management system for a large organisation.
Now based in an idyllic lochside location in the West of Scotland, he is currently involved in a range of development projects, whenever he can drag his gaze away from the stunning surrounding views, that is!
Ged is a Microsoft MVP, Senior Editor for DevCity.NET, vbCity Developer Community Leader and Admin, Helper of the Month competition winner and DevCity.NET newsletter Editor.
View all articles by Ged Mead...
In many situations the familiar pie chart is as good a way as any of presenting data in pictorial form. The Graphics Class in .Net offers us an easy way to create this style of chart in order to display facts and figures to the world.

The above chart can be created with very few lines of code.
However, it is obviously of very limited use on its own. The picture is colourful, but we need to know what the segments represent.
Let’s look at a basic but quite useful way of doing this – using a chart key:

With a key like the one shown above, it is very easy for the user to identify which part of the pie chart represents which of the companies. To make the data even more useful, each company’s individual total is also shown in the key.
As you will see, the Graphics Class in the .Net Framework makes it quite easy to create pie charts and keys of this kind. So we’ll use the built-in facilities of DrawPie and DrawString and avoid reinventing the wheel.