各位高人你们好!
我想利用MSChart1制作一个动态的饼形图,打算在饼形图中显示出来两种统计数据各占百分之几,如下是本人VB中的编码。请诸位高人帮助如何添加编码、修改程序能达到如上目的……。谢谢了!
----------------------------------------------------------------------------------------
Private Sub Command1_Click()
On Error GoTo finderror
Dim sql As String
Dim i As Integer
grdLoupan.Clear '显示查询结果前将表格中原有记录清除
sql = "select * from 机械性能表 where 牌号 = '" & Trim(Combo1.Text) & "' and 建档日期 between #" & DTPicker1.Value & "# and #" & DTPicker2.Value & "# order by 建档日期 desc"
rs_xingneng.CursorLocation = adUseClient
rs_xingneng.open sql, conn, adOpenKeyset, adLockPessimistic
If Not rs_xingneng.EOF Then
setgrid
setgridhead
displaygrid
rs_xingneng.MoveFirst
If Not rs_xingneng.EOF Then '将检索结果在相应的文本框上显示出来
With MSChart1
.chartType = VtChChartType14dLine
.TitleText = "强度/硬度控制统计图"
.RowCount = rs_xingneng.RecordCount
For i = 1 To rs_xingneng.RecordCount
.ColumnCount = 1
.Row = i
.Column = 1
.Data = rs_xingneng.Fields("强度")
.RowLabel = rs_xingneng.Fields("硬度")
rs_xingneng.MoveNext
Next
End With
End If
End If
rs_xingneng.Close
Exit Sub
rs_xingneng.Close
Exit Sub
Exit Sub
finderror:
MsgBox Err.Description
End Sub