This documentation is archived and is not being maintained.

MSChart Control

Visual Studio .NET 2003

A chart that graphically displays data.




The MSChart control supports the following features:

  • True three-dimensional representation.
  • Support for all major chart types.
  • Data grid population via random data and data arrays.

The MSChart control is associated with a data grid (DataGrid object). This data grid is a table that holds the data being charted. The data grid can also include labels used to identify series and categories on the chart. The person who designs your chart application fills the data grid with information by inserting data or by importing data from a spreadsheet or array.


'In this example, the sales for two companies are shown for four months.
'Create the data array and bind it to the ChartData property.
   Dim Sales(,) As Object = New Object(, ) _
      {{"Company", "Company A", "Company B"}, _
      {"June", 20, 10}, _
      {"July", 10, 5}, _
      {"August", 30, 15}, _
      {"September", 14, 7}}
   chtSales.ChartData = Sales
   'Add a title and legend.
   With Me.chtSales
      .Title.Text = "Sales"
      .Legend.Location.LocationType = _
      .Legend.Location.Visible = True
   End With
   'Add titles to the axes.
   With Me.chtSales.Plot
      .Axis(MSChart20Lib.VtChAxisId.VtChAxisIdX).AxisTitle.Text = "Year"
      .Axis(MSChart20Lib.VtChAxisId.VtChAxisIdY).AxisTitle.Text = "Millions of $"
   End With
   'Set custom colors for the bars.
   With Me.chtSales.Plot
      'Yellow for Company A
      ' -1 selects all the datapoints.
      .SeriesCollection(1).DataPoints(-1).Brush.FillColor.Set(250, 250, 0)
      'Purple for Company B
      .SeriesCollection(2).DataPoints(-1).Brush.FillColor.Set(200, 50, 200)
   End With

See Also

Properties, Methods, and Events | AngleUnits Constants | Axis Object | AxisGrid Object | AxisScale Object | AxisTitle Object | Backdrop Object | Brush Object | CategoryScale Object | Coor Object | DataGrid Object | DataPoint Object | DataPointLabel Object | Error Messages (MSChart Control) | Fill Object | Footnote Object | Frame Object | Intersection Object | Label Object | LCoor Object | Legend Object | Light Object | LightSource Object | Location Object | Marker Object | Pen Object | Plot Object | PlotBase Object | Rect Object | Series Object | SeriesMarker Object | SeriesPosition Object | Shadow Object | StatLine Object | TextLayout Object | Tick Object | Title Object | ValueScale Object | View3D Object | VtColor Object | VtFont Object | Wall Object | Weighting Object