?? module1.bas
字號(hào):
Attribute VB_Name = "Module1"
Public minvalue, maxvalue, mintime, maxtime As Double
Public temp(), data() As Variant
Public mtop, mbottom, mleft, mright, mcount, mtemp, trvindex, mhead, maxnum As Integer
Public Sub drawzx(ByVal head As Integer, ByVal length As Integer, ByVal all_len As Integer)
Dim ttdata() As Variant
Dim j As Integer
Dim n As Integer
'Dim secdata(10, 1) As Double
n = UBound(data, 2)
ReDim ttdata(length - 1, n)
For i = 0 To length - 1
For k = 0 To n
ttdata(i, k) = data(head + i, k)
Next k
Next i
setxianshi ("ze")
'波形圖外觀設(shè)置
With Form1.MSChart1
.ColumnCount = n + 1
.TitleText = "速度 m/min"
.Plot.Axis(VtChAxisIdX).AxisTitle.Text = "時(shí)間"
.Plot.Axis(VtChAxisIdY).AxisTitle.Text = "數(shù)值"
' '設(shè)置圖線的外觀
.Plot.LocationRect.Min.Set 0, 0
For j = 1 To n
.Plot.SeriesCollection(j).Pen.Width = 1 '222
.Plot.SeriesCollection(j).Pen.Style = VtPenStyleSolid
j = j + 1
Next j
If n >= 1 Then
.Plot.SeriesCollection(1).LegendText = Form3.Combo2.Text
End If
If n >= 3 Then
.Plot.SeriesCollection(2).LegendText = Form3.Combo4.Text
End If
If n >= 5 Then
.Plot.SeriesCollection(3).LegendText = Form3.Combo6.Text
End If
If n >= 7 Then
.Plot.SeriesCollection(4).LegendText = Form3.Combo8.Text
End If
If n >= 9 Then
.Plot.SeriesCollection(5).LegendText = Form3.Combo10.Text
End If
' '設(shè)置XY軸
.Plot.Axis(VtChAxisIdX).ValueScale.Auto = True
.Plot.Axis(VtChAxisIdY).ValueScale.Auto = False
'// 設(shè)置最大值
' .Plot.Axis(VtChAxisIdX).ValueScale.Maximum = maxtime
' If maxvalue > 1 Then
' .Plot.Axis(VtChAxisIdY).ValueScale.Maximum = Round(maxvalue * 1.5, 0)
' End If
' If maxvalue > 0.1 Then
' .Plot.Axis(VtChAxisIdY).ValueScale.Maximum = Round(maxvalue * 1.5, 1)
' End If
' If maxvalue > 0.01 Then
' .Plot.Axis(VtChAxisIdY).ValueScale.Maximum = Round(maxvalue * 1.5, 2)
' End If
'
If maxvalue > 100 Then
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = Round(maxvalue * 1.5)
ElseIf maxvalue > 75 Then
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 100
ElseIf maxvalue > 50 Then
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 75
ElseIf maxvalue > 30 Then
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 50
ElseIf maxvalue > 20 Then
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 30
ElseIf maxvalue > 10 Then
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 20
ElseIf maxvalue > 5 Then
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 10
ElseIf maxvalue > 3 Then
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 5
ElseIf maxvalue > 1 Then
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 3
ElseIf maxvalue > 0.5 Then
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 1
ElseIf maxvalue > 0.3 Then
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 0.5
ElseIf maxvalue > 0.1 Then
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 0.3
ElseIf maxvalue > 0.05 Then
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 0.1
ElseIf maxvalue > 0.03 Then
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 0.05
ElseIf maxvalue > 0.01 Then
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 0.03
Else
.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = maxvalue * 1.5
End If
' '// 設(shè)置最小值
.Plot.Axis(VtChAxisIdY).ValueScale.Minimum = 0
' .Plot.Axis(VtChAxisIdX).ValueScale.Minimum = mintime
'//
'.Plot.Axis(VtChAxisIdX).ValueScale.MajorDivision = 6 'X軸主要網(wǎng)格數(shù)量
.Plot.Axis(VtChAxisIdY).ValueScale.MajorDivision = 5 'Y軸主要網(wǎng)格數(shù)量
' .Plot.Axis(VtChAxisIdX).ValueScale.MinorDivision = 0 'X軸次要網(wǎng)格數(shù)量
' .Plot.Axis(VtChAxisIdY).ValueScale.MinorDivision = 0 'Y軸次要網(wǎng)格數(shù)量
.Plot.Axis(VtChAxisIdX).AxisGrid.MajorPen.Style = VtPenStyleDotted
.Plot.Axis(VtChAxisIdY).AxisGrid.MajorPen.Style = VtPenStyleDotted
' MSChart1.ColumnCount = 2
' MSChart1.RowCount = 380
Form1.MSChart1.Plot.AutoLayout = False
Form1.MSChart1.Plot.UniformAxis = False
Form1.MSChart1.chartType = VtChChartType2dXY '設(shè)置圖形為二維散點(diǎn)圖
Form1.MSChart1.ChartData = ttdata '數(shù)據(jù)
End With
End Sub
Public Sub setxianshi(i As String)
If i = "grid" Then
Form1.VSPrinter1.Visible = False
Form1.cmmset.Visible = False
Form1.MSChart1.Visible = False
Form1.VSFG1.Visible = True
Form1.VSFG1.Top = 840
Form1.VSFG1.Left = 2640
End If
If i = "ze" Then
Form1.VSPrinter1.Visible = False
Form1.cmmset.Visible = False
Form1.MSChart1.Visible = True
Form1.VSFG1.Visible = False
Form1.MSChart1.Top = 840
Form1.MSChart1.Left = 2640
End If
If i = "prt" Then
Form1.VSPrinter1.Visible = True
Form1.cmmset.Visible = True
Form1.MSChart1.Visible = False
Form1.VSFG1.Visible = False
Form1.VSPrinter1.Top = 840
Form1.VSPrinter1.Left = 2640
End If
End Sub
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -