注册 登录
编程论坛 VB6论坛

MSChart控件不显示轴标题

wcb8302 发布于 2013-01-16 16:12, 547 次点击
为什么我的MSChart控件不显示2个轴的标题及日期数据呢?代码如下,求大家解答,老半天也没有解决,感谢!
数据表字段:日期,合计
Private Sub Command1_Click()
  Adodc1.RecordSource = "select * from out"
  Adodc1.Refresh
  Set MSChart1.DataSource = Adodc1
  With MSChart1
    .chartType = VtChChartType2dLine
    .Plot.Axis(VtChAxisIdY).ValueScale.Auto = False
    .Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 1000
    .Plot.Axis(VtChAxisIdY).ValueScale.Minimum = 0
    .Plot.Axis(VtChAxisIdY).ValueScale.MinorDivision = 1
    .Plot.Axis(VtChAxisIdY).ValueScale.MajorDivision = 5
    .ColumnCount = 1
    .Plot.Axis(VtChAxisIdX, 0).AxisTitle.Text = "日期"
    .Plot.Axis(VtChAxisIdY, 0).AxisTitle.Text = "合计"
    .Plot.Axis(VtChAxisIdX, 0).AxisTitle.VtFont.Size = 50
    .Plot.Axis(VtChAxisIdY, 0).AxisTitle.VtFont.Size = 50
    .Title.Text = "每日支出折线图"
    .ShowLegend = True
    Dim i As Integer
    For i = 1 To .Plot.SeriesCollection.Count
      .Plot.SeriesCollection(i).DataPoints(-1).DataPointLabel.LocationType = VtChLabelLocationTypeAbovePoint
    Next
    If Adodc1.Recordset.RecordCount > 0 Then
      Adodc1.Recordset.MoveFirst
    Else
      Exit Sub
    End If
    For i = 0 To Adodc1.Recordset.RecordCount - 1
      .Column = 1
      .RowCount = Adodc1.Recordset.RecordCount
      .Row = i + 1
      .RowLabel = CStr(Adodc1.Recordset.Fields("日期"))
      .Data = Adodc1.Recordset.Fields("合计")
      .ColumnLabel = "每日支出合计"
      Adodc1.Recordset.MoveNext
    Next
  End With
  
End Sub

只有本站会员才能查看附件,请 登录
1 回复
#2
wcb83022013-01-16 17:51
此问题本人已解决,忽然想到了属性,通过右击MSChart--属性,在里面设置了一下,就好了!
1