下面代码显示6个班级的平均分,直方图的上方显示的是各班的平均分,我想在每个柱形的下面显示对应的班级,怎样办呢?
下面的只能把图例显示在直方图的右侧。 
With MSChart1
    Dim i As Integer
    .ChartData = Array_1                                         '将一维数组赋给MSChart控件
    .TitleText = Me.List1.Text & "科各班平均分比较"
    .ShowLegend = True '显示图例
    If Index = 0 Then
      .ChartType = 1                                              '以直方图形式显示一维数组元素值
    ElseIf Index = 1 Then
      .ChartType = 14                                             '以饼图形式显示一维数组元素值
  End If
    For i = 1 To 6
      .Plot.SeriesCollection(i).LegendText = i & "班"         '图例中列标签名赋值
    
    .Plot.SeriesCollection(i).DataPoints(-1).DataPointLabel.LocationType = VtChLabelLocationTypeAbovePoint
   Next

解决方案 »

  1.   

    右键点击 MSChart1 属性,自己设置
      

  2.   

    属性里好象没有图例位置的设置,只有是否显示图例设置
    再如下面,我是想把 图例中列标签名 显示在对应的直方条的下面,因为我的只是一维数组。Private Sub Command2_Click()
    With MSChart1
        Dim I As Integer
        Dim Array_1(1 To 10) As Integer
        For I = 1 To 10
            Array_1(I) = I
        Next I
        .ChartData = Array_1                     '将一维数组赋给MSChart控件
        .TitleText = "一维数组图表示例"
        .ShowLegend = True '显示图例
         .chartType = 1                        '以直方图形式显示一维数组元素值
        For I = 1 To 10
          .Plot.SeriesCollection(I).LegendText = "Y" & I            '图例中列标签名赋值
        Next I
        .Plot.SeriesCollection(1).DataPoints(-1).DataPointLabel.LocationType = VtChLabelLocationTypeAbovePoint
        .Plot.SeriesCollection(2).DataPoints(-1).DataPointLabel.LocationType = VtChLabelLocationTypeAbovePoint
      .Plot.SeriesCollection(3).DataPoints(-1).DataPointLabel.LocationType = VtChLabelLocationTypeAbovePoint
     
     .Plot.Axis(VtChAxisIdX, 0).AxisTitle.Text = "222"
     
       End With
    End Sub