home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- BorderStyle = 1 'Fixed Single
- Caption = "Animated Data Example"
- ClientHeight = 5340
- ClientLeft = 1200
- ClientTop = 1530
- ClientWidth = 7425
- Height = 5805
- Icon = "moving.frx":0000
- Left = 1110
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 5340
- ScaleWidth = 7425
- Top = 1155
- Width = 7605
- Begin Threed.SSPanel pnlControls
- Height = 5175
- Left = 5460
- TabIndex = 1
- Top = 60
- Width = 1815
- _Version = 65536
- _ExtentX = 3201
- _ExtentY = 9128
- _StockProps = 15
- BackColor = 12632256
- BevelOuter = 1
- Begin VB.CommandButton Command1
- Caption = "Start"
- Height = 495
- Left = 300
- TabIndex = 10
- Top = 3840
- Width = 1215
- End
- Begin VB.CommandButton cmdStop
- Caption = "Stop"
- Height = 495
- Left = 300
- TabIndex = 9
- Top = 4440
- Width = 1215
- End
- Begin VB.Frame fraChartType
- Caption = " Chart Type "
- Height = 2595
- Left = 180
- TabIndex = 2
- Top = 240
- Width = 1455
- Begin VB.OptionButton optChartType
- Caption = "Surface"
- Height = 195
- Index = 6
- Left = 240
- TabIndex = 11
- Top = 2160
- Width = 1095
- End
- Begin VB.OptionButton optChartType
- Caption = "2 D Line"
- Height = 195
- Index = 0
- Left = 240
- TabIndex = 8
- Top = 360
- Value = -1 'True
- Width = 1095
- End
- Begin VB.OptionButton optChartType
- Caption = "3 D Line"
- Height = 195
- Index = 1
- Left = 240
- TabIndex = 7
- Top = 660
- Width = 1095
- End
- Begin VB.OptionButton optChartType
- Caption = "2 D Bar"
- Height = 195
- Index = 2
- Left = 240
- TabIndex = 6
- Top = 960
- Width = 1095
- End
- Begin VB.OptionButton optChartType
- Caption = "3 D Bar"
- Height = 195
- Index = 3
- Left = 240
- TabIndex = 5
- Top = 1260
- Width = 1095
- End
- Begin VB.OptionButton optChartType
- Caption = "Radar"
- Height = 195
- Index = 4
- Left = 240
- TabIndex = 4
- Top = 1560
- Width = 1095
- End
- Begin VB.OptionButton optChartType
- Caption = "Polar"
- Height = 195
- Index = 5
- Left = 240
- TabIndex = 3
- Top = 1860
- Width = 1095
- End
- End
- End
- Begin VCIFiLib.VtChart VtChart1
- Height = 5175
- Left = 60
- TabIndex = 0
- Top = 60
- Width = 5235
- _version = 65536
- _extentx = 9234
- _extenty = 9128
- _stockprops = 96
- borderstyle = 1
- filename = "moving.frx":030A
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Dim run As Boolean
- Dim gChartType%, gRows%, gCols%
- Private Sub cmdStop_Click()
- run = False
- End Sub
- Private Sub Command1_Click()
- Const AngleIncrement = 0.2
- Const PI = 3.14159264
- Static DataAngle#, aMin#
- MousePointer = 11 ' ' Wait cursor
- run = True
- While run
- '' Move existing data to the left
- VtChart1.DataGrid.MoveData 1, 1, gRows - 1, gCols, 0, 1
-
- DataAngle = DataAngle + AngleIncrement
- aMin = (DataAngle / PI) - 1
- If (aMin < 0) Then aMin = 0
-
- Select Case gChartType
- Case VtChChartType2dXY
- With VtChart1.DataGrid
- .SetData 1, 1, DataAngle / PI, False
- .SetData 1, 2, Sin(DataAngle), False
- .SetData 1, 3, DataAngle / PI, False
- .SetData 1, 4, Sin(DataAngle + PI / 2), False
- .SetData 1, 5, DataAngle / PI, False
- .SetData 1, 6, Sin(DataAngle - PI / 2), False
- End With
-
- Case VtChChartType3dLine, VtChChartType2dBar, VtChChartType3dBar, VtChChartType2dRadar
- With VtChart1.DataGrid
- .SetData 1, 3, Sin(DataAngle + PI / 2), False
- .SetData 1, 2, Sin(DataAngle), False
- .SetData 1, 1, Sin(DataAngle - PI / 2), False
- End With
-
- Case VtChChartType2dPolar
- With VtChart1.DataGrid
- .SetData 1, 1, (DataAngle * 30), False
- .SetData 1, 2, Cos(DataAngle), False
- .SetData 1, 3, (DataAngle * 50), False
- .SetData 1, 4, Cos(DataAngle), False
- .SetData 1, 5, (DataAngle * 10), False
- .SetData 1, 6, Cos(DataAngle), False
- End With
-
- Case VtChChartType3dSurface
- With VtChart1.DataGrid
- .SetData 1, 1, Sin(DataAngle), False
- .SetData 1, 2, Sin(DataAngle + AngleIncrement), False
- .SetData 1, 3, Sin(DataAngle + AngleIncrement * 2), False
- .SetData 1, 4, Sin(DataAngle + AngleIncrement * 3), False
- .SetData 1, 5, Sin(DataAngle + AngleIncrement * 4), False
- End With
-
- End Select
-
- VtChart1.Plot.Axis(VtChAxisIdX).ValueScale.Maximum = aMin + 1
- VtChart1.Plot.Axis(VtChAxisIdX).ValueScale.Minimum = aMin
-
- DoEvents
- Wend
- MousePointer = 0 ' default cursor
- End Sub
- Private Sub Form_Load()
- VtChart1.DrawMode = VtChDrawModeBlit
- Call optChartType_Click(0)
- run = False
- End Sub
- Private Sub Form_Resize()
- VtChart1.Repaint = False
- pnlControls.Left = ScaleWidth - pnlControls.Width - 60
- pnlControls.Height = ScaleHeight - 120
- VtChart1.Width = pnlControls.Left - 150
- VtChart1.Height = ScaleHeight - 120
- VtChart1.Repaint = True
- End Sub
- Private Sub optChartType_Click(Index As Integer)
- Select Case Index
- Case 0
- gChartType = VtChChartType2dXY
- gRows = 18
- gCols = 6
- Case 1
- gChartType = VtChChartType3dLine
- gRows = 18
- gCols = 3
- Case 2
- gChartType = VtChChartType2dBar
- gRows = 18
- gCols = 3
- Case 3
- gChartType = VtChChartType3dBar
- gRows = 18
- gCols = 3
- Case 4
- gChartType = VtChChartType2dRadar
- gRows = 18
- gCols = 3
- Case 5
- gChartType = VtChChartType2dPolar
- gRows = 18
- gCols = 6
- Case 6
- gChartType = VtChChartType3dSurface
- gRows = 5
- gCols = 5
- Case Else
- MsgBox "Chart type not available"
- Call optChartType_Click(0)
- End Select
-
- SetChartTypeAndSize VtChart1, gChartType, gRows, gCols
- ZeroGrid VtChart1
-
- End Sub
-