Promote Your Blog
Google

Friday, March 2, 2012

How To Use .NET Charting Control

.NET provides a wonderful control for charting plots. Here are basic steps:

  • Drag and drop CHART control from toolbox to your application form/dialog etc.
  • Position it appropriately
  • There can be multiple plots (CHART AREAS) on a Chart
  • Add SERIES to Collection and assign each series to appropriate CHART AREAS
  • Choose type of plot - Line, Bar,....
  • Set Legends
  • Set Titles
  • Label Axis
  • IsValueIndexed must be set to TRUE for X-Axis

Don't worry!!! A detailed tutorial is on the way that will teach you how to do all these steps..illustrating through actual snapshots.

Then, there are some operations on chart that you do programmatically. Some of these operations are:

Imports System.Drawing.Printing

Imports System.IO

Imports System.Windows.Forms.DataVisualization.Charting

Show/Hide

Chart1.Show()

Chart1.Hide()


Clearing Points in a Chart Series

Chart1.Series("Name given to series at design time").Points.Clear()


Setting width from Series line

Chart1.Series("Name given to series at design time ").BorderWidth =


Adding Points to a Series

Chart1.Series("Name given to series at design time ").Points.AddXY(x, y)

Saving Output As Image

Chart1.SaveImage(“meaningful filename”, ChartImageFormat.Jpeg)

No comments:

Post a Comment