'
To test this code, the trial or full version of XYChart must be installed
on your computer.
' 1. Start a new standard Visual Basic project
' 2. Copy the code below directly into the project
' 3. On the form, place a new XYChart control named XYChart4Ctl1 (default)
' 4. Run the project
Private Sub Form_Load()
' Configure XYChart control
With XYChart4Ctl1
.NumProfiles = 1
.NumYScales = 1
.NumXScales = 1
'
Legend
.Legend.Visible = True
.Legend.BorderVisible
= False
.Legend.YScaleVisible
= False
.Toolbar.Visible = True
'
Grids
.YGrid(1).LineOption =
loCustom
.YGrid(1).LineColor =
RGB(0, 170, 0)
.XGrid(1).LineOption =
loCustom
.XGrid(1).LineColor =
.YGrid(1).LineColor
'
X Scale
.XScale(1).ScaleType =
stLinear
.XScale(1).Label = ""
.XScale(1).TicksFont.Color
= vbWhite
.XScale(1).LabelFont.Color
= .XScale(1).TicksFont.Color
.XScale(1).ScaleMode =
smManual
.XScale(1).Min = 0
.XScale(1).Max = 1000
'
Y Scale
.YScale(1).Visible = True
.YScale(1).Label = ""
.YScale(1).TicksFont.Color
= vbWhite
.YScale(1).LabelFont.Color
= .YScale(1).TicksFont.Color
.YScale(1).ScaleType =
stLog
.YScale(1).ScaleMode =
smManual
.YScale(1).Min = 1
.YScale(1).Max = 1000
'
Crosshairs
.CrossHairs.YCoordInLegend
= True
.CrossHairs.Color = vbWhite
.CrossHairs.Width = woTwoPoint
.CrossHairs.HorizontalVisible
= False
.CrossHairs.CoordsBackcolor
= RGB(0, 128, 0)
'
Chart and Plot formatting
.BackColor = RGB(64, 64,
64)
.Plot.BackColor = RGB(64,
64, 64)
.Plot.Border.LineOption
= loNone
.Plot.Border.LineWidth
= woOnePoint
.Plot.Border.LineColor
= RGB(0, 128, 0)
'
Profile
.Profile(1).YScale = 1
.Profile(1).LineOption
= loCustom
.Profile(1).LineWidth
= woTwoPoint
.Profile(1).LineStyle
= soSolid
.Profile(1).MarkerOption
= loNone
.Profile(1).LineColor
= RGB(192, 0, 0)
.Profile(1).Label = "Profile
1"
.Profile(1).NumSamples
= 100
'
Create random data and populate array
ReDim ChartData(1 To .Profile(1).NumSamples,
1 To 2 * .NumProfiles)
For i = 1 To .Profile(1).NumSamples
ChartData(i,
1) = (i - 1) * 10 + 1
ChartData(i,
2) = 1000 * Rnd + 1
Next i
.ChartData = ChartData
.Refresh
End With
End Sub
' Resize Event
Private Sub Form_Resize()
With XYChart4Ctl1
.Left
= 0
.Top
= 0
.Width
= Me.ScaleWidth
.Height
= Me.ScaleHeight
.Refresh
End With
End Sub
|