The Basics of Charting with the MS Chart Control - Organization of the chart
(Page 3 of 4 )
Although we see only a chart on the form, it has an organization that is not easily visible in this default view. In order to access the properties and methods, one needs to understand the structure. The chart consists of the following areas:
- Title
- Legend
- Footnote
- Plot
These regions are revealed using the code shown in the next paragraph, written to the form load event:
Private Sub Form_Load()
With MSChart1
'title area
.Title.Text = "Great Chart"
'legend area
.ShowLegend = True
'footnote area
.FootnoteText = "This is a foot note"
.Footnote.VtFont.VtColor.Set 25, 150, 200
'plot area
.Plot.Backdrop.Fill.Style = VtFillStyleBrush
.Plot.Backdrop.Fill.Brush.FillColor.Set 100, 200, 200
End With
End Sub
This form will show up as shown in the next picture when the code is run. It is easy to associate the code with the displayed chart. Once you understand this organization, it is somewhat easier to access the properties and methods. Unfortunately Microsoft's documentation on this is rather sparse, and where available you find only undecipherable references. The related product in Office is very superior to this control and better documented.

As you can guess from looking at the code, the properties and methods can be accessed by the dot notation and the intellisense support. Without this support this would have been an impossible control to use. To fill the chart's plot area background, look at this code. Honestly I would not have guessed this statement. Hats off to intellisense.
MSChart1.Plot.Backdrop.Fill.Brush.FillColor.Set 100, 200, 200
Next: Getting into the plot area >>
More Code Examples Articles
More By Jayaram Krishnaswamy