'Add a title and legend.
With Me.AxMSChart1
.Title.Text = "Sales"
.Legend.Location.LocationType = _
MSChart20Lib.VtChLocationType.VtChLocationTypeBottom
.Legend.Location.Visible = True
End With
'Add titles to the axes.
With Me.AxMSChart1.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.AxMSChart1.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