标题:关于mschart问题,代码错误1119,对象未初始化或无效
取消只看楼主
gumengyin
Rank: 1
等 级:新手上路
帖 子:21
专家分:7
注 册:2014-3-19
结帖率:66.67%
 问题点数:0 回复次数:0 
关于mschart问题,代码错误1119,对象未初始化或无效
Private Sub Command1_Click()
          Dim i   As Integer
          rs.Open "select 车速,sum(case when  样件序列='3' then 振动级 end ) As '第三组' ,sum(case when 样件序列='4' then 振动级 end ) As '第四组' from 加速度测试结果 where 品牌='" & Combo1.Text & "'and 驱动形式='" & Combo2.Text & "' and 平台='" & Combo5.Text & "'  and 减震形式='" & Combo4.Text & "' and 悬置形式='" & Combo3.Text & "' group by 车速  ", conn, adOpenKeyset, adLockOptimistic
            
        '  Set MSChart1.DataSource = rs
         
  With MSChart1
  
       '// 以线条方式显示
      .chartType = 3
      
      '// 把刻录改为手工方式
      .Plot.Axis(VtChAxisIdY).ValueScale.Auto = False
      
       '// 设置最大值
      .Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 127
      
      '// 设置最小值
      .Plot.Axis(VtChAxisIdY).ValueScale.Minimum = 118
      
      '// 设置每格为 1
      .Plot.Axis(VtChAxisIdY).ValueScale.MinorDivision = 1
      
      '// 增加测试数据
      .ColumnCount = 3
      
      '//轴坐标标题
      .Plot.Axis(VtChAxisIdX, 0).AxisTitle = "车速"
      .Plot.Axis(VtChAxisIdY, 0).AxisTitle = "振动级(dB)"
      
      '//轴坐标标题字体大小的设置
      .Plot.Axis(VtChAxisIdX, 0).AxisTitle.VtFont.Size = 15
      .Plot.Axis(VtChAxisIdY, 0).AxisTitle.VtFont.Size = 15
      
      '//设置图表标题
      .Title.Text = "振动级"
      
     
      
      
      '// 将图表作为图例的背景。
      .ShowLegend = False
      '// 标记每个点的值
      For i = 1 To .Plot.SeriesCollection.Count
         .Plot.SeriesCollection(i).DataPoints(-1).DataPointLabel.LocationType = VtChLabelLocationTypeAbovePoint
      Next
      
      If rs.RecordCount > 0 Then
          rs.MoveFirst
      Else
          Exit Sub
      End If
      
       For i = 0 To rs.RecordCount - 1
        .Column = 1
         .RowCount = rs.RecordCount
         .Row = i + 1
         .RowLabel = rs("车速")
         .Data = rs("第三组")
         
         .Column = 2
         .Data = rs("第四组")
         
       rs.MoveNext
      Next
     
  End With

End Sub
搜索更多相关主题的帖子: 测试结果 加速度 where 
2014-03-25 16:08



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-429131-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.201068 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved