Article Options
Premium Sponsor
Premium Sponsor

 »  Home  »  .NET Newbie  »  Chart Success: GDI+ Graphics at work. Part 1
 »  Home  »  Windows Development  »  Graphics  »  Chart Success: GDI+ Graphics at work. Part 1
Chart Success: GDI+ Graphics at work. Part 1
by Ged Mead | Published  03/06/2005 | .NET Newbie Graphics | Rating:
Ged Mead

Ged Mead (XTab) is a Microsoft Visual Basic MVP who has been working on computer software and design for more than 25 years. His journey has taken him through many different facets of IT. These include training as a Systems Analyst, working in a mainframe software development environment, creating financial management systems and a short time spent on military laptop systems in the days when it took two strong men to carry a 'mobile' system.

Based in an idyllic lochside location in the West of Scotland, he is currently involved in an ever-widening range of VB.NET, WPF and Silverlight development projects. Now working in a consultancy environment, his passion however still remains helping students and professional developers to take advantage of the ever increasing range of sophisticated tools available to them.

Ged is a regular contributor to forums on vbCity and authors articles for DevCity. He is a moderator on VBCity and the MSDN Tech Forums and spends a lot of time answering technical questions there and in several other VB forum sites. Senior Editor for DevCity.NET, vbCity Developer Community Leader and Admin, and DevCity.NET Newsletter Editor. He has written and continues to tutor a number of free online courses for VB.NET developers.


View all articles by Ged Mead...
Let’s Not Reinvent the Wheel

   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.


Basic Pie Chart


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.

Sponsored Links