Article Options
Premium Sponsor
Premium Sponsor

 »  Home  »  .NET Newbie  »  GDI+ Chart Success Part 6: Dynamic Line Chart  »  Summary
 »  Home  »  Windows Development  »  Graphics  »  GDI+ Chart Success Part 6: Dynamic Line Chart  »  Summary
 »  Home  »  Windows Development  »  Win Forms  »  GDI+ Chart Success Part 6: Dynamic Line Chart  »  Summary
GDI+ Chart Success Part 6: Dynamic Line Chart
by Ged Mead | Published  08/22/2006 | .NET Newbie Graphics Win Forms | 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...

Possible Enhancements

The next logical step would be to create a Chart Class and a Class Library to make your code more portable between applications.

Following that, if you are expecting to have to use many of these kinds of charts many times in the future then the best long term plan might well be to create your own custom control and add it to your Visual Studio Toolbox.

For the time being though, we will settle for this set of generic line chart procedures. The Class Library and User Control will have to wait for a later date.

Nevertheless, we have covered quite a lot of ground in this article and have produced a useful way of creating dynamic line charts. We have certainly come a long way from our first simple Pie Chart back in Part 1!

Topics Covered

In this article, we covered the following topics:

  • Brushes
  • Dispose method
  • Double Buffering
  • DrawLine method
  • DrawImage method
  • DrawString
  • FillPolygon method
  • Font object
  • Format menu item
  • Graphics.FromImage method
  • Pens
  • Scaling
  • TranslateTransform method


Demonstration Sample Solution

All the code described is included in the attached sample solution, which was created using  VB.NET 2003. 

Series Summary

 It's taken me a while to complete all six articles in this set, but I hope that they have helped you go from the very basic out-of-the-box pie chart to the potentially quite sophisticated dynamic line charts.   Of course, there are lots of other charts we could consider and many enhancements to what we have done so far, but I'll leave you to take it on from here.  If you have any questions about any of the techniques don't hesitate to post them up in the VB.NET Forum and I'll do my best to help out.



Acknowledgements:  I would like to thank Rod Stephens of VBHelper for the original idea of cutting and pasting a Bitmap to an offset position to create the illusion of chart movement.

Also many thanks to the generous folks at Techsmith for gifting me a copy of their excellent Snagit utility which made the creation and editing of screenshots so easy.

How would you rate the quality of this article?
1 2 3 4 5
Poor Excellent
Tell us why you rated this way (optional):

Article Rating
The average rating is: No-one else has rated this article yet.

Article rating:3.19642857142857 out of 5
 224 people have rated this page
Article Score61004
Sponsored Links