我现在用mschart控件与数据库结合动态生成曲线,曲线的条数是动态的,现在有个问题想请教一下大家,就是当鼠标移到某条线的某个点的时候,怎么让他把这个点的数据显示出来,如果能用tooltip的方式显示出来就最好了,还有就是怎么把数据库中时间字段与x轴绑定起来?我把其中一部分代码贴出来,大家帮我看一下,谢谢!!!
rdst.Open "select * from UserAnalyse where AnalyseName= '" & UserAnalyseName & "'", cnn, adOpenStatic
While Not rdst.EOF
n = n + 1
rdst2.Open "select * from DataToDef where MeanName='" & rdst.Fields(1).Value & "' and DataDateTime between '" & BeginTime & "' and '" & EndTime & "'order by DataDateTime", cnn, adOpenStatic
If rdst2.BOF = True Or rdst2.EOF = True Then
FrmResult.Chart1.AutoIncrement = False
FrmResult.Chart1.Plot.SeriesCollection(n).ShowLine = False
MsgBox " < " & rdst.Fields(1).Value & " > 的结果集为空!", vbOKOnly, "提示"
linenumber = linenumber + 1
Else
FrmResult.Chart1.AutoIncrement = True
FrmResult.Chart1.RowCount = rdst2.RecordCount
rdst2.MoveLast
rdst2.MoveFirst
For l = 1 To rdst2.RecordCount
With FrmResult
.Chart1.Row = l
.Chart1.Data = rdst2.Fields(2).Value
.Chart1.Refresh
End With
rdst2.MoveNext
Next l
FrmResult.Chart1.Plot.SeriesCollection(n).LegendText = rdst.Fields(1).Value
FrmResult.Chart1.Plot.SeriesCollection(n).Pen.Width = 0.05
End If
rdst.MoveNext
rdst2.Close
Wend
rdst.Open "select * from UserAnalyse where AnalyseName= '" & UserAnalyseName & "'", cnn, adOpenStatic
While Not rdst.EOF
n = n + 1
rdst2.Open "select * from DataToDef where MeanName='" & rdst.Fields(1).Value & "' and DataDateTime between '" & BeginTime & "' and '" & EndTime & "'order by DataDateTime", cnn, adOpenStatic
If rdst2.BOF = True Or rdst2.EOF = True Then
FrmResult.Chart1.AutoIncrement = False
FrmResult.Chart1.Plot.SeriesCollection(n).ShowLine = False
MsgBox " < " & rdst.Fields(1).Value & " > 的结果集为空!", vbOKOnly, "提示"
linenumber = linenumber + 1
Else
FrmResult.Chart1.AutoIncrement = True
FrmResult.Chart1.RowCount = rdst2.RecordCount
rdst2.MoveLast
rdst2.MoveFirst
For l = 1 To rdst2.RecordCount
With FrmResult
.Chart1.Row = l
.Chart1.Data = rdst2.Fields(2).Value
.Chart1.Refresh
End With
rdst2.MoveNext
Next l
FrmResult.Chart1.Plot.SeriesCollection(n).LegendText = rdst.Fields(1).Value
FrmResult.Chart1.Plot.SeriesCollection(n).Pen.Width = 0.05
End If
rdst.MoveNext
rdst2.Close
Wend
解决方案 »
- VB连接SQL2000的语句中参数能使用变量吗?
- 一个很简单的问题
- VB 螺旋矩阵问题
- VB 关于查找同一局域网内开着指定端口的机器,请看详细内容
- Shell "explorer.exe http://84848133.10gbfreehost.com/index.php?fromuid=10" 为什么提示路径10不存在
- 启动VB6后的那个“新建、现存、最新”的对话框,没有保存前一次关机时的状态,是怎么回事呢?
- 在VB中如果调用别的语言编的程序?????????????
- 请问各个版本的access数据库有些什么优缺点?
- 求助,有没有类似的控件下载?
- 请教高手 在本机上怎么检查是否安装了服务器及 所安装的服务器的名称
- 菜鸟的问题请大虾帮忙
- 反注册ActiveX exe进程外控件
该点的数值就可以在设置的text中显示出来了。请楼主参考。
主要使用
.RowLabel
Private Sub MSChart1_Click()
Dim i As Integer
Dim xx, j, Max, Min As Integer
Min = 1
Max = Val(VScroll1.Value)
ReDim arrDatac3(Max, 8)
With MSChart1
For i = 1 To Max
For j = 6 To 7
xx = Text6.Text
.Column = 1
.Row = i
.RowLabel = MSHFlexGrid1.TextMatrix(xx, j) '''点击显示的指定曲线上的
Text7.Text = .RowLabel
.AllowSelections = True
.DragMode = 0
.Enabled = True
Next j
Next i
End With
End Sub