Visual Basic: MSChart Control

MSChart Control Example

The following example displays a three-dimensional chart with eight columns and rows of data and sets the legend parameters.

Private Sub Command1_Click()
   With MSChart1
      ' Displays a 3d chart with 8 columns and 8 rows
      ' data.
      .ChartType = VtChChartType3dBar
      .ColumnCount = 8
      .RowCount = 8
      For column = 1 To 8
         For row = 1 To 8
            .Column = column
            .Row = row
            .Data = row * 10
         Next row
      Next column
      ' Use the chart as the backdrop of the legend.
      .ShowLegend = True
      .SelectPart VtChPartTypePlot, index1, index2, _
      index3, index4
      .EditCopy
      .SelectPart VtChPartTypeLegend, index1, _
      index2, index3, index4
      .EditPaste
   End With
End Sub
Show: