Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 104

VERSION 5.

00
Object = "{3655D37C-ED6E-4A12-8680-0DBE7ED31A98}#1.0#0";
"pego32f.ocx"
Begin VB.Form Form2
Caption
=
"Form2"
ClientHeight
=
5805
ClientLeft
=
870
ClientTop
=
3165
ClientWidth
=
8355
LinkTopic
=
"Form2"
PaletteMode
=
1 'UseZOrder
ScaleHeight
=
5805
ScaleWidth
=
8355
Begin Pego32fLib.Pego Pego1
Height
=
4815
Left
=
240
TabIndex
=
0
Top
=
120
Width
=
7935
_Version
=
65536
_ExtentX
=
13996
_ExtentY
=
8493
_StockProps
=
96
_AllProps
=
"Form2.frx":0000
End
Begin VB.Timer Timer1
Enabled
=
0
'False
Interval
=
250
Left
=
120
Top
=
4800
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim m_nRealTimeCounter As Long
Dim m_nSinCounter As Long
Private Sub Form_Load()
Dim
Dim
Dim
Dim
Dim
Dim

lResult As Long
rct As Rect
lWidth As Long
lHeight As Long
lRight As Long
lBottom As Long

Dim
Dim
Dim
Dim
Dim
Dim

lLeft As Long
lTop As Long
hDC As Long
hWnd As Long
lScreenWidth As Long
lScreenHeight As Long

Dim
Dim
Dim
Dim

PixelsPerInchX As Long
PixelsPerInchY As Long
TwipsX As Long
TwipsY As Long

'get screen X,Y PixelsPerInch


hDC = GetDC(hWnd)
PixelsPerInchX = GetDeviceCaps(hDC, 88)
PixelsPerInchY = GetDeviceCaps(hDC, 90)
lResult = ReleaseDC(hWnd, hDC)
'capture Screen Resolution
lScreenWidth = GetSystemMetrics(0)
lScreenHeight = GetSystemMetrics(1)
'get the number of screen twips
TwipsX = (1440 / PixelsPerInchX)
TwipsY = (1440 / PixelsPerInchY)
Dim nTaskLoc
'To get the usable desktop area, use SystemParametersInfo()...
If SystemParametersInfo(48, 0, ByVal VarPtr(rct), 0) <> 0 Then
lWidth = rct.right
lHeight = rct.bottom
lRight = rct.right - rct.left
lBottom = rct.bottom - rct.top
lLeft = rct.left
lTop = rct.top
'is TaskBar on top, bottom, left, or right
If lBottom <> lScreenHeight Then
' it's top or bottom
If lTop <> 0 Then nTaskLoc = 1 Else nTaskLoc = 0
ElseIf lRight <> lScreenWidth Then
'it's left or right
If lLeft <> 0 Then nTaskLoc = 2 Else nTaskLoc = 3
End If
lWidth = rct.right * TwipsX
lLeft = rct.left * TwipsX
lHeight = rct.bottom * TwipsY
lTop = rct.top * TwipsY
If (nTaskLoc = 0) Then
Form2.left = 0
Form2.top = Screen.Height / 3

Form2.Width = Screen.Width
Form2.Height = Screen.Height * 2# / 3# - (Screen.Height lHeight)
ElseIf (nTaskLoc = 1) Then
Form2.left = 0
Form2.top = Screen.Height / 3
Form2.Width = Screen.Width
Form2.Height = Screen.Height * 2# / 3#
ElseIf (nTaskLoc = 2) Then
Form2.left = lLeft
Form2.top = Screen.Height / 3
Form2.Width = Screen.Width - lLeft
Form2.Height = Screen.Height * 2# / 3#
Else
Form2.left = 0
Form2.top = Screen.Height / 3
Form2.Width = lWidth
Form2.Height = Screen.Height * 2# / 3#
End If
Else
Form2.left = 0
Form2.top = Screen.Height / 3
Form2.Width = Screen.Width
Form2.Height = Screen.Height * 1.9 / 3
End If
Call CreateAllCharts
End Sub
Private Sub Form_Resize()
Pego1.left = 0
Pego1.top = 0
Pego1.Width = ScaleWidth
Pego1.Height = ScaleHeight
End Sub
Private Sub Pego1_CursorMoved()
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim

t As Long
nX As Long
fHigh As Single
fLow As Single
fOpen As Single
fClose As Single
fVolume As Single
szDate As String
szFmt As String

nX = Pego1.CursorPoint
'// Get Data at closest point //
fHigh = Pego1.YData(0, nX)
fLow = Pego1.YData(1, nX)
fOpen = Pego1.YData(2, nX)
fClose = Pego1.YData(3, nX)
fVolume = Pego1.YData(7, nX)
szDate = Pego1.PointLabels(nX)
'// Get numeric precision //
nX = Pego1.DataPrecision
szFmt = "###."
For t = 0 To nX - 1
szFmt = szFmt + "0"
Next t
'// Place text in table annotation //
Pego1.WorkingTable = 0
Pego1.TAText(12, 0) = szDate
Pego1.TAText(13,
Pego1.TAText(14,
Pego1.TAText(15,
Pego1.TAText(16,
Pego1.TAText(17,
"#############")

0)
0)
0)
0)
0)

=
=
=
=
=

"H:"
"L:"
"O:"
"C:"
"V:"

+
+
+
+
+

Format$(fHigh, szFmt)
Format$(fLow, szFmt)
Format$(fOpen, szFmt)
Format$(fClose, szFmt)
Format$(fVolume,

Pego1.PEdrawtable 0
End Sub
Private Sub Pego1_DataHotSpot(DblClk As Integer, subsetindex As
Long, pointindex As Long)
'// Example 030 is only example with data hot spots //
Pego1.CursorMode = PECM_POINT
'// Enable Vertical Cursor
Mode.
Pego1.CursorPoint = pointindex '// Set Cursor's focus
selected point.
End Sub
Private Sub Pego1_MouseMove(Button As Integer, Shift As Integer,
x As Single, y As Single)
Dim nChart As Integer
Dim s As String
If Form1.List1.ListIndex < 0 Then Exit Sub
s = Form1.List1.List(Form1.List1.ListIndex)

s = left$(s, 3)
nChart = CInt(s)
If nChart = 7 Then
Dim nA As Long
Dim nX As Long
Dim nY As Long
Dim fX As Double
Dim fY As Double
Dim t As Long
Dim nLeft As Integer
Dim nTop As Integer
Dim nRight As Integer
Dim nBottom As Integer
Dim pX As Integer
Dim pY As Integer
'// get last mouse location within control //'
Pego1.GetLastMouseMove pX, pY
'// test to see if this is within grid area //'
Pego1.GetRectGraph nLeft, nTop, nRight, nBottom
If pX > nLeft And pX < nRight And pY > nTop And pY < nBottom

Then

nA = 0
'// Initialize axis if using
OverlapMultiAxes, else this function will
'// return the axis if MultiAxesSubsets is
used without OverlapMultiAxes
nX = pX
'// Initialize nX and nY with mouse location
nY = pY
Pego1.PEconvpixeltograph nA, nX, nY, fX, fY, 0, 0, 0
Form2.Caption = Str$(fX) + "
" + Str$(fY)
Else
Form2.Caption = "Outside Grid"
End If
ElseIf nChart = 14 Then
Dim hsType As Integer
Dim extra1 As Long
Dim extra2 As Long
'// get last mouse location within control //'
Pego1.GetLastMouseMove pX, pY
'// Calls PEgethotspot function to fill hot spot data
structure with hot spot data at given x and y
Pego1.PEgethotspot pX, pY
'// Calls PEgethotspot //'
Pego1.GetHotSpotData hsType, extra1, extra2

If (hsType = PEHS_DATAPOINT) Then


s = "DataPoint value " + Str$(Pego1.YData(extra1,
extra2))
Form2.Caption = s
ElseIf (hsType = PEHS_SUBSET) Then
s = "Subset Legend is " + Pego1.SubsetLabels(extra1)
Form2.Caption = s
ElseIf (hsType = PEHS_POINT) Then
s = "Point Label is " + Pego1.PointLabels(extra1)
Form2.Caption = s
Else
Form2.Caption = "No Hot Spot"
End If
ElseIf nChart = 28 Then
'// get last mouse location within control //
Pego1.GetLastMouseMove pX, pY
nA = 0
'// Initialize axis, non-zero only if using
MultiAxesSubsets
nX = pX
'// Initialize nX and nY with mouse location
nY = pY
Pego1.PEconvpixeltograph nA, nX, nY, fX, fY, 0, 0, 0
'// We now know data coordinates for mouse location //
'// Use fX to interpolate each subset to find approximate Y
value //
Dim Subset1Y As Single
Dim Subset2Y As Single
Dim Subset3Y As Single
Dim Subset4Y As Single
Dim slope As Single
Dim y0 As Single
Dim Y1 As Single
Dim Y2 As Single
Dim X1 As Single
Dim X2 As Single
nX = Int(fX) - 1
'// nX is floor of fX
X2 = nX + 1
'// x2 is right most point index
X1 = nX
'// x1 is left most point index or nX
If (fX < 1 Or fX > 12) Then
Pego1.WorkingTable = 0
Pego1.TAText(0, 2) = "
Pego1.TAText(0, 5) = "
Pego1.WorkingTable = 1
Pego1.TAText(0, 2) = "
Pego1.TAText(0, 5) = "
Pego1.PEdrawtable 0

"
"
"
"

Pego1.PEdrawtable 1
Exit Sub
End If
fX = fX - 1#
'// 1st subset //
Y2 = Pego1.YData(0, nX + 1)
Y1 = Pego1.YData(0, nX)
slope = (Y2 - Y1) / (X2 - X1)
y0 = Y1 - (slope * X1)
Subset1Y = (slope * fX) + y0
'// 2nd subset //
Y2 = Pego1.YData(1, nX + 1)
Y1 = Pego1.YData(1, nX)
slope = (Y2 - Y1) / (X2 - X1)
y0 = Y1 - (slope * X1)
Subset2Y = (slope * fX) + y0
'// 3rd subset //
Y2 = Pego1.YData(2, nX + 1)
Y1 = Pego1.YData(2, nX)
slope = (Y2 - Y1) / (X2 - X1)
y0 = Y1 - (slope * X1)
Subset3Y = (slope * fX) + y0
'// 4th subset //
Y2 = Pego1.YData(3, nX + 1)
Y1 = Pego1.YData(3, nX)
slope = (Y2 - Y1) / (X2 - X1)
y0 = Y1 - (slope * X1)
Subset4Y = (slope * fX) + y0
'// Place text in table annotation //
Pego1.WorkingTable = 0
Pego1.TAText(0, 2) = Format$(Subset1Y, "##0.00")
Pego1.TAText(0, 5) = Format$(Subset2Y, "##0.00")
Pego1.WorkingTable = 1
Pego1.TAText(0, 2) = Format$(Subset3Y, "##0.00")
Pego1.TAText(0, 5) = Format$(Subset4Y, "##0.00")
Pego1.PEdrawtable 0
Pego1.PEdrawtable 1
ElseIf nChart = 30 Then
Dim
Dim
Dim
Dim

fI As Double
fHigh As Single
fLow As Single
fOpen As Single

Dim
Dim
Dim
Dim

fClose As Single
fVolume As Single
szDate As String
szFmt As String

'// get last mouse location within control //


Pego1.GetLastMouseMove pX, pY
nA = 0
'// Initialize axis, non-zero only if using
MultiAxesSubsets
nX = pX
'// Initialize nX and nY with mouse location
nY = pY
Pego1.PEconvpixeltograph nA, nX, nY, fX, fY, 0, 0, 0
'// We now know data coordinates for mouse location //
'// Code to pick closest point index //
fY = Abs(fX - Int(fX))
If (fY > 0.5) Then
nX = Int(fX)
Else
nX = Int(fX) - 1
End If
If (fX < 1 Or fX > 731)
data file
Pego1.TAText(12, 0)
Pego1.TAText(13, 0)
Pego1.TAText(14, 0)
Pego1.TAText(15, 0)
Pego1.TAText(16, 0)
Pego1.TAText(17, 0)
Pego1.PEdrawtable 0
Exit Sub
End If

Then
=
=
=
=
=
=

'// 731 points per subset in

"
"
"
"
"
"

"
"
"
"
"
"

nX = nX - 1#
'// Get Data at closest point //
fHigh = Pego1.YData(0, nX)
fLow = Pego1.YData(1, nX)
fOpen = Pego1.YData(2, nX)
fClose = Pego1.YData(3, nX)
fVolume = Pego1.YData(7, nX)
szDate = Pego1.PointLabels(nX)
'// Place text in table annotation //
'// Get numeric precision //
nX = Pego1.DataPrecision
szFmt = "###."
For t = 0 To nX - 1

szFmt = szFmt + "0"


Next t
'// Place text in table annotation //
Pego1.WorkingTable = 0
Pego1.TAText(12, 0) = szDate
Pego1.TAText(13,
Pego1.TAText(14,
Pego1.TAText(15,
Pego1.TAText(16,
Pego1.TAText(17,
"#############")

0)
0)
0)
0)
0)

=
=
=
=
=

"H:"
"L:"
"O:"
"C:"
"V:"

+
+
+
+
+

Format$(fHigh, szFmt)
Format$(fLow, szFmt)
Format$(fOpen, szFmt)
Format$(fClose, szFmt)
Format$(fVolume,

Pego1.PEdrawtable 0
ElseIf nChart = 32 Then
If Pego1.ProcessingMouseMove = True Then Exit Sub
'// If mouse is inside an axis, change it's back color to
WHITE //
'// Determine if mouse is within an axis //
'Dim nLeft As Integer
'Dim nTop As Integer
'Dim nRight As Integer
'Dim nBottom As Integer
'Dim pX As Integer
'Dim pY As Integer
Dim a As Integer
Dim nChangedAxisColor As Integer
nChangedAxisColor = -1
'// get last mouse location within control //'
Pego1.GetLastMouseMove pX, pY
For a = 0 To 15
'// test to see if this is within axis area //'
Pego1.WorkingAxis = a
Pego1.GetRectAxis nLeft, nTop, nRight, nBottom
If pX > nLeft And pX < nRight
nBottom Then
If Pego1.AxisBackColor <>
255) Then
Pego1.AxisBackColor =
255)
Pego1.AxisForeColor =
0)
nChangedAxisColor = a
Exit For

And pY > nTop And pY <


Pego1.PEargb(255, 255, 255,
Pego1.PEargb(255, 255, 255,
Pego1.PEargb(255, 255, 0,

End If
End If
Next a
If (nChangedAxisColor <> -1) Then
For a = 0 To 15
If (a <> nChangedAxisColor) Then
Pego1.WorkingAxis = a
Pego1.AxisBackColor = 1
Pego1.AxisForeColor = 1
End If
Next a
Pego1.PEactions = 0
End If
Else
Form2.Caption = ""
End If
End Sub
Public Sub CreateAllCharts()
Dim nChart As Integer
Dim t As String
If Form1.List1.ListIndex < 0 Then Exit Sub
t = Form1.List1.List(Form1.List1.ListIndex)
t = left$(t, 3)
nChart = CInt(t)
Pego1.PEreset

'// same as PEactions = REVERT_TO_DEFAULTS

Pego1.PEreinitialize
Pego1.PrepareImages = True
Timer1.Enabled = False
If nChart = 0 Then
'****************************************************************
*****'
'****************************************************************
*****'
'000 *** Simple Graph ***
'//! Right button click to show popup menu. //
'//! Double Click to show customization dialog. //
'//! Left-Click and drag to draw zoom box. Use popup memu or
'z' to undo zoom. //

'// Simple example show the basics of a graph object. //


'// Graph's generally only contain YData because we assume
'// data is plotted equally spaced left to right.
Dim s As Long
Dim p As Long
'// Enable Bar Glass Effect //
Pego1.BarGlassEffect = True
'// Enable Plotting style gradient and bevel features //
Pego1.AreaGradientStyle = PEPGS_RADIAL_BOTTOM_RIGHT
Pego1.AreaBevelStyle = PEBS_MEDIUM_SMOOTH
Pego1.SplineGradientStyle = PEPGS_RADIAL_BOTTOM_RIGHT
Pego1.SplineBevelStyle = PESBS_MEDIUM_SMOOTH
'// v7.2 new features //
Pego1.PointGradientStyle = PEPGS_VERTICAL_ASCENT_INVERSE
Pego1.PointBorderColor = Pego1.PEargb(100, 0, 0, 0)
Pego1.LineSymbolThickness = 3
Pego1.AreaBorder = 1
Pego1.AllowSvgExport = True
'// Prepare images in memory //
Pego1.PrepareImages = True
'// Pass Data //
Pego1.Subsets = 4
Pego1.Points = 12
For s = 0 To 3
For p = 0 To 11
Pego1.YData(s, p) = ((p + 1) * 50) + (Rnd() * 250) +
2 + 700# - ((s * 140#))
Next p
Next s
Pego1.DataShadows = PEDS_SHADOWS
Pego1.FocalRect = False
Pego1.PlottingMethod = GPM_AREA
Pego1.GridLineControl = PEGLC_BOTH
Pego1.GridStyle = PEGS_DOT
Pego1.AllowRibbon = True
Pego1.AllowZooming = PEAZ_HORZANDVERT
Pego1.ZoomStyle = PEZS_RO2_NOT
'// Enable middle mouse dragging //
Pego1.MouseDraggingX = True
Pego1.MouseDraggingY = True
Pego1.MainTitle = "Units Sold per Month"
Pego1.SubTitle = ""

Pego1.YAxisLabel = "Units Sold"


Pego1.XAxisLabel = "Month"
'// subset labels //
Pego1.SubsetLabels(0)
Pego1.SubsetLabels(1)
Pego1.SubsetLabels(2)
Pego1.SubsetLabels(3)

=
=
=
=

"Texas"
"Florida"
"Washington"
"California"

'// point labels //


Pego1.PointLabels(0) = "January"
Pego1.PointLabels(1) = "February"
Pego1.PointLabels(2) = "March"
Pego1.PointLabels(3) = "April"
Pego1.PointLabels(4) = "May"
Pego1.PointLabels(5) = "June"
Pego1.PointLabels(6) = "July"
Pego1.PointLabels(7) = "August"
Pego1.PointLabels(8) = "September"
Pego1.PointLabels(9) = "October"
Pego1.PointLabels(10) = "November"
Pego1.PointLabels(11) = "December"
'// subset colors //
Pego1.SubsetColors(0)
Pego1.SubsetColors(1)
Pego1.SubsetColors(2)
Pego1.SubsetColors(3)

=
=
=
=

Pego1.PEargb(128,
Pego1.PEargb(128,
Pego1.PEargb(128,
Pego1.PEargb(128,

'// subset line types //


Pego1.SubsetLineTypes(0)
Pego1.SubsetLineTypes(1)
Pego1.SubsetLineTypes(2)
Pego1.SubsetLineTypes(3)
Pego1.SubsetLineTypes(4)
Pego1.SubsetLineTypes(5)
Pego1.SubsetLineTypes(6)
Pego1.SubsetLineTypes(7)
'// subset point types //
Pego1.SubsetPointTypes(0)
Pego1.SubsetPointTypes(1)
Pego1.SubsetPointTypes(2)
Pego1.SubsetPointTypes(3)
Pego1.SubsetPointTypes(4)
Pego1.SubsetPointTypes(5)
Pego1.SubsetPointTypes(6)
Pego1.SubsetPointTypes(7)

=
=
=
=
=
=
=
=

198, 0, 0)
0, 198, 198)
198, 198, 0)
0, 198, 0)

PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
=
=
=
=
=
=
=
=

PEPT_DOTSOLID
PEPT_UPTRIANGLESOLID
PEPT_SQUARESOLID
PEPT_DOWNTRIANGLESOLID
PEPT_DOT
PEPT_UPTRIANGLE
PEPT_SQUARE
PEPT_DOWNTRIANGLE

Pego1.SimplePointLegend = True
Pego1.SimpleLineLegend = True
Pego1.LegendStyle = PELS_1_LINE

'// Allow stacked type graphs //


Pego1.NoStackedData = False
'// Various other features //
Pego1.FixedFonts = True
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_MEDIUM_LINE
Pego1.GradientBars = 8
Pego1.LineShadows = True
Pego1.MainTitleBold = True
Pego1.SubTitleBold = True
Pego1.LabelBold = True
Pego1.TextShadows = PETS_BOLD_TEXT
Pego1.FontSize = PEFS_LARGE
Pego1.DataPrecision = PEDP_ONEDECIMAL
Pego1.GraphPlusTable = PEGPT_BOTH
Pego1.MarkDataPoints = False
Pego1.ImageAdjustLeft = 20
Pego1.ImageAdjustRight = 20
Pego1.ImageAdjustBottom = 10
'// Set various export defaults //
Pego1.DpiX = 600
Pego1.DpiY = 600
Pego1.ExportSizeDef = PEESD_NO_SIZE_OR_PIXEL
Pego1.ExportTypeDef = PEETD_PNG
Pego1.ExportDestDef = PEEDD_CLIPBOARD
Pego1.ExportUnitXDef = "1280"
Pego1.ExportUnitYDef = "768"
Pego1.ExportImageDpi = 300
Pego1.AllowSvgExport = True
Pego1.RenderEngine = PERE_DIRECT2D
Pego1.AntiAliasGraphics = True
Pego1.AntiAliasText = True
'// Always call PEactions at end **'
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 1 Then
'****************************************************************
*****'
'****************************************************************
*****'
'001 Graph With Auto Statistical Subsets
'//! Right button click to show popup menu. //

'//! Double Click to show customization dialog. //


'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
'// Below tells object to automatically generate statistical
'// comparison subsets, object will actually have
'// 6 subsets when finished initializing.
Pego1.AutoStatSubsets(0) = PEAS_AVGAP
subset
Pego1.AutoStatSubsets(1) = PEAS_AVGPP
subset

' This will be 5th


' This will be 6th

'// Other various properties //


Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_DARK_LINE
Pego1.LegendStyle = PELS_1_LINE_INSIDE_AXIS
Pego1.PlottingMethod = GPM_BAR
Pego1.PlottingMethodII = GPMII_POINTSPLUSLINE
Pego1.MarkDataPoints = True
'// Always call PEactions at end **'
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 2 Then
'****************************************************************
*****'
'****************************************************************
*****'
'002 Graph With Permanent and Scrolling Subsets
'//! Scroll vertical scroll bar to revolve subsets. //
'//! Right button click to show popup menu. //
'//! Double Click to show customization dialog. //
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
'// tells object to automatically generate statistical
'// comparison subsets, the object will have
'// 6 subsets when finished reinitializing.
Pego1.AutoStatSubsets(0) = PEAS_AVGAP ' This will be 5th
subset
Pego1.AutoStatSubsets(1) = PEAS_AVGPP ' This will be 6th
subset
'// Since we are scrolling subsets one at a time,
'// we can set the PEAS_AVGAP and PEAS_AVGPP subsets as
'// permanent. This allows individual subsets to be

'// compared to the averages of all points.


Pego1.RandomSubsetsToGraph(0) = 4 ' zero based 5th subset,
PEAS_AVGAP
Pego1.RandomSubsetsToGraph(1) = 5 ' zero based 6th subset,
PEAS_AVGPP
'// If we comment this line out, you will only see the
'// 5th and 6th subset selected above. RandomSubsetsToGraph
'// will either control which subset you see or which
'// subsets are permanent if ScrollingSubsets is non-zero.
Pego1.ScrollingSubsets = 1 ' Scroll one subset at a time
Pego1.TableWhat = PETW_ALLSUBSETS
'// Add a table //
Pego1.GraphPlusTable = PEGPT_BOTH
Pego1.DataPrecision = 0
Pego1.FontSize = PEFS_MEDIUM
'// Other various properties //
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_MEDIUM_NO_BORDER
Pego1.LegendStyle = PELS_1_LINE_INSIDE_AXIS
Pego1.PlottingMethod = PEGPM_BAR
Pego1.PlottingMethodII = GPMII_POINTSPLUSLINE
Pego1.BestFitDegree = PEBFD_4TH
Pego1.MarkDataPoints = True
Pego1.LegendStyle = PELS_1_LINE
Pego1.DataShadows = PEDS_3D
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 3 Then
'****************************************************************
*****'
'****************************************************************
*****'
'003 Graph With Right Y Axis Comparison Subsets
'// This example builds upon the basic CreateSimpleGraph '000'
example chart //
Call CreateSimpleGraph
'// Set plotting method to Bar //
Pego1.PlottingMethod = GPM_BAR
'// Designate last 2 subsets as right y axis comparison
subsets
Pego1.RYAxisComparisonSubsets = 2
'// Set Comparison PlottingMethod
Pego1.PlottingMethodII = GPMII_POINTSPLUSLINE

'// Label Right Y Axis //


Pego1.RYAxisLabel = "Expected"
'// Other various properties //
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_DARK_NO_BORDER
Pego1.SubsetColors(0) = Pego1.PEargb(128,
Pego1.SubsetColors(1) = Pego1.PEargb(128,
Pego1.SubsetColors(2) = Pego1.PEargb(128,
Pego1.SubsetColors(3) = Pego1.PEargb(128,

100, 0, 0)
0, 100, 100)
198, 198, 0)
0, 198, 0)

Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 4 Then
'****************************************************************
*****'
'****************************************************************
*****'
'004 Graph showing simple high-low-close
'// This example builds upon the basic CreateSimpleGraph '000'
example chart //
Call CreateSimpleGraph
'// Set PlottingMethod and SpecificPlotMode Type //
Pego1.PlottingMethod = GPM_SPECIFICPLOTMODE
Pego1.SpecificPlotMode = PESPM_HIGHLOWCLOSE
'// setting this true causes high-low-close to be multi
colored
Pego1.SpecificPlotModeColor = True
'// Change Data to something more appropriate //
Pego1.Subsets = 3
'// set number of subsets
Pego1.Points = 12
'// number of data points
'// Pass YData, Line Start, Line End, and Close Value //
For s = 0 To 2
For p = 0 To 11
If s = 0 Then
Pego1.YData(s, p) = ((p + 1) * 10 + (Rnd * 25))
ElseIf s = 1 Then
Pego1.YData(s, p) = ((p + 1) * 40 + (Rnd * 25))
ElseIf s = 2 Then
Pego1.YData(s, p) = ((p + 1) * 20 + (Rnd * 25))
End If
Next p
Next s
Pego1.PEactions = REINITIALIZE_RESETIMAGE

ElseIf nChart = 5 Then


'****************************************************************
*****'
'****************************************************************
*****'
'005 Graph With Custom Y Axis
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
'// Change to SplineArea //
Pego1.PlottingMethod = GPM_SPLINE_AREA
'// Disable default scale //
Pego1.ShowYAxis = PESA_EMPTY
'// Generally, a custom y axis will need manual range control
//

Pego1.ManualScaleControlY = PEMSC_MINMAX
Pego1.ManualMinY = 0#
Pego1.ManualMaxY = 1500#

'// Create custom grid lines with HorzLineAnnotations //


'// Note that GridLineControl will control these
annotations //
Pego1.HorzLineAnnotation(0) = 200
Pego1.HorzLineAnnotationType(0) = PELAT_GRIDLINE
Pego1.HorzLineAnnotationText(0) = "|LLow Value"
Pego1.HorzLineAnnotation(1) = 500
Pego1.HorzLineAnnotationType(1) = PELAT_GRIDLINE
Pego1.HorzLineAnnotationText(1) = "|LMedium Value"
Pego1.HorzLineAnnotation(2) = 800
Pego1.HorzLineAnnotationType(2) = PELAT_GRIDLINE
Pego1.HorzLineAnnotationText(2) = "|LHigh Value"
Pego1.HorzLineAnnotation(3) = 350
Pego1.HorzLineAnnotationType(3) = PELAT_GRIDTICK
Pego1.HorzLineAnnotationText(3) = ""
Pego1.HorzLineAnnotation(4) = 650
Pego1.HorzLineAnnotationType(4) = PELAT_GRIDTICK
Pego1.HorzLineAnnotationText(4) = ""
//

'// Set LeftMargin to allocate space for line annotation text


'// Use the longest string used in annotations.
Pego1.LeftMargin = "Medium Value "
'// Set this to see annotations //

Pego1.ShowAnnotations = True
'// Increase line annotation text size //
Pego1.LineAnnotationTextSize = 100
'// Put Grid In Front of Bars //
Pego1.GridInFront = True
'// Other various properties //
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_LIGHT_INSET
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 6 Then
'****************************************************************
*****'
'****************************************************************
*****'
'006 Graph showing use of Null Data Gaps
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
'// Change Null Data Value //
'// Note that Scientific Graph has NullDataValueX and
NullDataValueY //
Pego1.NullDataValue = -9999#
'// Change to two subsets and set a few data points to
nulls //
Pego1.Subsets = 2
Pego1.YData(0, 3) = -9999#
Pego1.YData(0, 4) = -9999#
Pego1.YData(0, 5) = -9999#
Pego1.YData(1, 5) = -9999# '//! Note that (1,6) and (1,8) are
valid points
Pego1.YData(1, 7) = -9999# '//! You will see symbols for
these points because
Pego1.YData(1, 9) = -9999# '//! they are surrounded by nulls.
'// Set line Plotting Method //
Pego1.PlottingMethod = GPM_POINTSPLUSLINE
'// Enable Null Data Gaps //
'// Using NullDataGaps, the subset's line will stop before
null data values //
'// If this line is commented out, then line will extend to

next non-null //
Pego1.NullDataGaps = True
'// Other various properties //
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_MEDIUM_INSET
Pego1.MarkDataPoints = True
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 7 Then
'****************************************************************
*****'
'****************************************************************
*****'
'007 Graph showing use of PEconvpixeltograph
'//! Look at TitleBar for the chart's window. As you
'//! move the mouse, you will see the coordinates of the
'//! mouse in the titlebar.
'//! Right button click to show popup menu. //
'//! Double Click to show customization dialog. //
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
'// Other various properties //
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_LIGHT_SHADOW
Pego1.MarkDataPoints = False
Pego1.PlottingMethod = GPM_POINTSPLUSSPLINE
Pego1.PEactions = REINITIALIZE_RESETIMAGE

'
'
'
'
'
'
'
'
'
'
'

'//////////////////////////////////////////'
'// From MouseMove event of Pego control //'
'//////////////////////////////////////////'
Dim nA As Long
Dim nX As Long
Dim nY As Long
Dim fX As Double
Dim fY As Double
Dim t As Long
Dim nLeft As Integer
Dim nTop As Integer
Dim nRight As Integer
Dim nBottom As Integer
Dim pX As Integer

'
Dim pY As Integer
'
'
'// get last mouse location within control //'
'
Pego1.GetLastMouseMove pX, pY
'
'
'// test to see if this is within grid area //'
'
Pego1.GetRectGraph nLeft, nTop, nRight, nBottom
'
If pX > nLeft And pX < nRight And pY > nTop And pY < nBottom
Then
'
nA = 0
'// Initialize axis if using
OverlapMultiAxes, else this function will
'
'// return the axis if MultiAxesSubsets is
used without OverlapMultiAxes
'
nX = pX
'// Initialize nX and nY with mouse location
'
nY = pY
'
Pego1.PEconvpixeltograph nA, nX, nY, fX, fY, 0, 0, 0
'
Form2.Caption = Str$(fX) + "
" + Str$(fY)
'
Else
'
Form2.Caption = "Outside Grid"
'
End If
ElseIf nChart = 8 Then
'****************************************************************
*****'
'****************************************************************
*****'
'008 Graph showing use of PointColors
'//! Right button click to show popup menu. //
'//! Double Click to show customization dialog. //
'//! Vertical scroll bar revolves through subsets. //
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
'//
'//
'//
For

Now to control color on per point basis, we use the


PointColors property array to assign a color to each
piece of YData.
s = 0 To 3
For p = 0 To 11
If s = 0 Then
Pego1.PointColors(s, p) = Pego1.PEargb(55, 15 +
((p + 1) * 20), 0, 0)
ElseIf (s = 1) Then
Pego1.PointColors(s, p) = Pego1.PEargb(55, 0, 15
+ ((p + 1) * 20), 0)
ElseIf (s = 2) Then
Pego1.PointColors(s, p) = Pego1.PEargb(55, 0, 0,
15 + ((p + 1) * 20))
ElseIf (s = 3) Then
Pego1.PointColors(s, p) = Pego1.PEargb(55, 0, 15 +

((p + 1) * 20), 15 + ((p + 1) * 20))


End If
Next p
Next s
'// Set SubsetColor to match brightest PointColor for each
subset //
Pego1.SubsetColors(0) = Pego1.PEargb(55, 198, 0, 0)
Pego1.SubsetColors(1) = Pego1.PEargb(55, 0, 198, 0)
Pego1.SubsetColors(2) = Pego1.PEargb(55, 0, 0, 198)
Pego1.SubsetColors(3) = Pego1.PEargb(55, 0, 198, 198)
'// Show 1 subset at a time //
Pego1.ScrollingSubsets = 1
Pego1.TableWhat = PETW_ALLSUBSETS
Pego1.FontSize = PEFS_MEDIUM
'// Add a table //
Pego1.GraphPlusTable = PEGPT_BOTH
Pego1.DataPrecision = 0
'// Slant the Point Labels //
Pego1.ForceVerticalPoints = PEFVP_SLANTED
Pego1.PlottingMethod = PEGPM_BAR
Pego1.DataShadows = PEDS_3D
Pego1.BarBevelStyle = PEBS_THICK_SMOOTH
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_DARK_INSET
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 9 Then
'****************************************************************
*****'
'****************************************************************
*****'
'009 Graph showing use of BestFitCoeffs
'// This example builds upon the basic CreateSimpleGraph '000'
example chart //
Call CreateSimpleGraph
'// Reduce to just two subsets //
Pego1.Subsets = 2
'// Set BestFitDegree and Plotting Method //
Pego1.BestFitDegree = PEBFD_3RD
Pego1.PlottingMethod = GPM_POINTSPLUSBFC

'// Call PEreinitialize and PEresetimage //


Pego1.PEactions = REINITIALIZE
'// PEreinitialize can be
used to determine ManualMaxY, etc
Pego1.PEactions = RESET_IMAGE
'// PEresetimage is needed
to calculate coeffs.
'// Now add annotations that represents coefficients //
'** First subset's coeffs. **'
t = "Texas y = " + Format$(Pego1.BestFitCoeffs(0, 3), "#.00")
+ "x^3 "
If Pego1.BestFitCoeffs(0, 2) >= 0 Then t = t + "+ "
t = t + Format$(Pego1.BestFitCoeffs(0, 2), "#.00") + "x^2 "
If Pego1.BestFitCoeffs(0, 1) >= 0 Then t = t + "+ "
t = t + Format$(Pego1.BestFitCoeffs(0, 1), "#.00") + "x "
If Pego1.BestFitCoeffs(0, 0) >= 0 Then t = t + "+ "
t = t + Format$(Pego1.BestFitCoeffs(0, 0), "#.00")
t = t + Chr$(10) '// Line feed
'// Second subset's coeffs. //'
t = t + "Florida y = " + Format$(Pego1.BestFitCoeffs(1, 3),
"#.00") + "x^3 "
If Pego1.BestFitCoeffs(1, 2) >= 0 Then t = t + "+ "
t = t + Format$(Pego1.BestFitCoeffs(1, 2), "#.00") + "x^2 "
If Pego1.BestFitCoeffs(1, 1) >= 0 Then t = t + "+ "
t = t + Format$(Pego1.BestFitCoeffs(1, 1), "#.00") + "x "
If Pego1.BestFitCoeffs(1, 0) >= 0 Then t = t + "+ "
t = t + Format$(Pego1.BestFitCoeffs(1, 0), "#.00")
'// Put text into a line annotations //'
Pego1.HorzLineAnnotation(0) = Pego1.ManualMaxY - 1
Pego1.HorzLineAnnotationType(0) = -1 '// no line, just text
Pego1.HorzLineAnnotationText(0) = t
'// Increases line annotation text size to max
Pego1.LineAnnotationTextSize = 100
Pego1.ShowAnnotations = True
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 10 Then
'****************************************************************
*****'
'****************************************************************
*****'
'010 Graph showing Stacked Bar
'//! Try this... Right Click chart and change the Plotting
Method to Horizontal Bar Stacked. //
'// This example builds upon the basic CreateSimpleGraph

'000' example chart //


Call CreateSimpleGraph
'// Enable Stacked type charts //
Pego1.NoStackedData = False
Pego1.AllowHorzBarStacked = True
'// Set plotting method //
Pego1.PlottingMethod = PEGPM_BARSTACKED
'// Add a table //
Pego1.GraphPlusTable = PEGPT_BOTH
Pego1.DataPrecision = 2
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 11 Then
'****************************************************************
*****'
'****************************************************************
*****'
'011 Graph showing MultiSubTitles
'//! Look for the text immediately above and below image. //
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
'//! Note that strings below always have two pipe symbols "|"
//
'// Set Multi Sub and Bottom Titles //
Pego1.MultiSubTitles(0) = "Top Left|Top Center|Top Right"
Pego1.MultiSubTitles(1) = "|Second Line only centered|"
'// Note that bottom titles get drawn from bottom up //
Pego1.MultiBottomTitles(0) = "Second Line only on left||"
Pego1.MultiBottomTitles(1) = "Bottom Left|Bottom Center|
Bottom Right"
'// Other various properties //
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_LIGHT_LINE
Pego1.MarkDataPoints = False
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 12 Then
'****************************************************************
*****'
'****************************************************************

*****'
'012 Graph showing MultiAxesSubsets 1
'//! Right button click to show popup menu. //
'//! Double Click to show customization dialog. //
'//! Left-Click and drag to draw zoom box. Use popup memu or
'z' to undo zoom. //
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
'// Now sub-divide subsets into 4 individual axes //
'// Each axis with one subset in each //
Pego1.MultiAxesSubsets(0) = 1
Pego1.MultiAxesSubsets(1) = 1
Pego1.MultiAxesSubsets(2) = 1
Pego1.MultiAxesSubsets(3) = 1
'// Set first axis parameters //
Pego1.WorkingAxis = 0
Pego1.YAxisLabel = "Label 1"
Pego1.PlottingMethod = GPM_BAR
'// Set second axis parameters //
Pego1.WorkingAxis = 1
Pego1.YAxisLabel = "Label 2"
Pego1.PlottingMethod = GPM_POINTSPLUSLINE
'// Set third axis parameters //
Pego1.WorkingAxis = 2
Pego1.YAxisLabel = "Label 3"
Pego1.PlottingMethod = GPM_BAR
'// Set fourth axis parameters //
Pego1.WorkingAxis = 3
Pego1.YAxisLabel = "Label 4"
Pego1.PlottingMethod = GPM_POINTSPLUSLINE
'// Reset WorkingAxis when done //
Pego1.WorkingAxis = 0
'// Add Axis Separator //
Pego1.MultiAxesSeparators = PEMAS_THIN
'// Axis Sizing //
Pego1.MultiAxesSizing = True
'// Get rid of 3d stuff //
Pego1.DataShadows = PEDS_NONE
'// Other various properties //

Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_DARK_NO_BORDER
Pego1.MarkDataPoints = False
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 13 Then
'****************************************************************
*****'
'****************************************************************
*****'
'013 Graph showing MultiAxesSubsets 2
'//! Right button click to show popup menu. //
'//! Double Click to show customization dialog. //
'//! Left-Click and drag to draw zoom box. Use popup memu or
'z' to undo zoom. //
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
'// Now sub-divide subsets 4 into individual axes //
'// Each axis with 2 subsets in each //
Pego1.MultiAxesSubsets(0) = 2
Pego1.MultiAxesSubsets(1) = 2
'// Set first axis parameters //
Pego1.WorkingAxis = 0
Pego1.YAxisLabel = "Label 1"
Pego1.PlottingMethod = GPM_BAR
Pego1.PlottingMethodII = GPMII_POINTSPLUSLINE
Pego1.ComparisonSubsets = 1
'// Set second axis parameters //
Pego1.WorkingAxis = 1
Pego1.YAxisLabel = "Label 2"
Pego1.PlottingMethod = GPM_BAR
Pego1.PlottingMethodII = GPMII_POINTSPLUSLINE
Pego1.ComparisonSubsets = 1
'// Reset WorkingAxis when done //
Pego1.WorkingAxis = 0
'// Separate Axes //
Pego1.MultiAxisStyle = PEMAS_SEPARATE_AXES
'// Axis Sizing //
Pego1.MultiAxesSizing = True
'// Legend Inside Each Axis //
Pego1.LegendStyle = PELS_1_LINE_INSIDE_AXIS

'// Other various properties //


Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_LIGHT_INSET
Pego1.MarkDataPoints = False
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 14 Then
'****************************************************************
*****'
'****************************************************************
*****'
'014 Graph showing use of PEgethotspot
'//! Move mouse over subset legends, point labels, or data
points
'//! and watch title bar.
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
'// Enable some various hot spots //
Pego1.AllowDataHotSpots = True
Pego1.AllowSubsetHotSpots = True
Pego1.AllowPointHotSpots = True
Pego1.HotSpotSize = PEHSS_LARGE
Pego1.PlottingMethod = GPM_POINTSPLUSSPLINE
Pego1.ComparisonSubsets = 2
Pego1.PlottingMethodII = GPMII_POINTSPLUSLINE
Pego1.MarkDataPoints = False
Pego1.PEactions = REINITIALIZE_RESETIMAGE
'////////////////////////////////////////////////
'// Code below is found in the MouseMove event //
'////////////////////////////////////////////////
Dim hsType As Integer
Dim extra1 As Long
Dim extra2 As Long

'
'
'
'
'
'// get last mouse location within control //'
'
Pego1.GetLastMouseMove pX, pY
'
'
'// Calls PEgethotspot function to fill hot spot data
structure with hot spot data at given x and y
'
Pego1.PEgethotspot pX, pY
'
'
'// Calls PEgethotspot //'
'
Pego1.GetHotSpotData hsType, extra1, extra2

'
'
If (hsType = PEHS_DATAPOINT) Then
'
s = "DataPoint value " + Str$(Pego1.YData(extra1,
extra2))
'
Form2.Caption = s
'
ElseIf (hsType = PEHS_SUBSET) Then
'
s = "Subset Legend is " + Pego1.SubsetLabels(extra1)
'
Form2.Caption = s
'
ElseIf (hsType = PEHS_POINT) Then
'
s = "Point Label is " + Pego1.PointLabels(extra1)
'
Form2.Caption = s
'
Else
'
Form2.Caption = "No Hot Spot"
'
End If
ElseIf nChart = 15 Then
'****************************************************************
*****'
'****************************************************************
*****'
'015 Graph showing use of GraphAnnotations
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
'// simplify chart by reducing subsets //
Pego1.Subsets = 2
Pego1.PlottingMethod = GPM_POINTSPLUSLINE
Pego1.RYAxisComparisonSubsets = 1
Pego1.PlottingMethodII = GPMII_LINE
'// no table //
Pego1.GraphPlusTable = PEGPT_GRAPH
Pego1.FontSize = PEFS_LARGE
'// Add some various graph annotations //
Pego1.ShowAnnotations = True
Pego1.GraphAnnotationTextSize = 115
'// Controls default placement of all annotations //
Pego1.AnnotationsInFront = False
'// Give user ability to show or hide annotations //
Pego1.AllowAnnotationControl = True
'// Place a symbol //
Pego1.GraphAnnotationX(0) = 1.5
Pego1.GraphAnnotationY(0) = 1095
Pego1.GraphAnnotationType(0) = PEGAT_SMALLDOTSOLID
Pego1.GraphAnnotationColor(0) = Pego1.PEargb(225, 198, 98, 0)

Pego1.GraphAnnotationText(0) = "Dot Gradient Shadow"


Pego1.GraphAnnotationGradientStyle(0) =
PEPGS_VERTICAL_ASCENT_INVERSE
Pego1.GraphAnnotationShadow(0) = True
Pego1.GraphAnnotationBold(0) = False
'// Draw some lines //'
Pego1.GraphAnnotationX(1) = 1.5
Pego1.GraphAnnotationY(1) = 1020
Pego1.GraphAnnotationType(1) = PEGAT_THINSOLIDLINE
Pego1.GraphAnnotationColor(1) = Pego1.PEargb(255, 0, 198,

198)

Pego1.GraphAnnotationText(1) = "Start"
Pego1.GraphAnnotationBold(1) = False
Pego1.GraphAnnotationX(2) = 2.5
Pego1.GraphAnnotationY(2) = 1120
Pego1.GraphAnnotationType(2) = PEGAT_LINECONTINUE
Pego1.GraphAnnotationColor(2) = 0
Pego1.GraphAnnotationText(2) = ""
Pego1.GraphAnnotationX(3) = 3.5
Pego1.GraphAnnotationY(3) = 1020
Pego1.GraphAnnotationType(3) = PEGAT_LINECONTINUE
Pego1.GraphAnnotationColor(3) = Pego1.PEargb(255, 0, 0, 198)
Pego1.GraphAnnotationText(3) = "End"
Pego1.GraphAnnotationBold(3) = False
'// How to draw an ellipse, rectangle, or roundrect. //'
Pego1.GraphAnnotationX(4) = 4.5
Pego1.GraphAnnotationY(4) = 1120
Pego1.GraphAnnotationType(4) = PEGAT_TOPLEFT
Pego1.GraphAnnotationColor(4) = 0
Pego1.GraphAnnotationText(4) = ""
Pego1.GraphAnnotationInFront(4) = PEAIF_IN_FRONT
Pego1.GraphAnnotationShadow(4) = True
Pego1.GraphAnnotationX(5) = 5.5
Pego1.GraphAnnotationY(5) = 1020
Pego1.GraphAnnotationType(5) = PEGAT_BOTTOMRIGHT
Pego1.GraphAnnotationColor(5) = 0
Pego1.GraphAnnotationText(5) = ""
Pego1.GraphAnnotationInFront(5) = PEAIF_IN_FRONT
Pego1.GraphAnnotationShadow(5) = True

53)

Pego1.GraphAnnotationX(6) = 5.5
Pego1.GraphAnnotationY(6) = 1020
Pego1.GraphAnnotationType(6) = PEGAT_ELLIPSE_FILL
Pego1.GraphAnnotationColor(6) = Pego1.PEargb(155, 234, 123,
Pego1.GraphAnnotationText(6) = ""
Pego1.GraphAnnotationInFront(6) = PEAIF_IN_FRONT

Pego1.GraphAnnotationShadow(6) = True
Pego1.GraphAnnotationGradientStyle(6) =
PEPGS_VERTICAL_ASCENT_INVERSE
'// Place a polygon //'
Pego1.GraphAnnotationX(7) = 6.5
Pego1.GraphAnnotationY(7) = 1120
Pego1.GraphAnnotationType(7) = PEGAT_STARTPOLY
Pego1.GraphAnnotationColor(7) = 0
Pego1.GraphAnnotationText(7) = ""
Pego1.GraphAnnotationX(8) = 7.5
Pego1.GraphAnnotationY(8) = 1120
Pego1.GraphAnnotationType(8) = PEGAT_ADDPOLYPOINT
Pego1.GraphAnnotationColor(8) = 0
Pego1.GraphAnnotationText(8) = ""
Pego1.GraphAnnotationX(9) = 7.5
Pego1.GraphAnnotationY(9) = 1020
Pego1.GraphAnnotationType(9) = PEGAT_ENDPOLYGON
Pego1.GraphAnnotationColor(9) = Pego1.PEargb(255, 0, 0, 0)
Pego1.GraphAnnotationText(9) = ""
'// Place a paragraph of text //'
Pego1.GraphAnnotationX(10) = 0
Pego1.GraphAnnotationY(10) = 0
Pego1.GraphAnnotationType(10) = PEGAT_STARTTEXT
Pego1.GraphAnnotationColor(10) = 0
Pego1.GraphAnnotationText(10) = "A line of text." + Chr$(10)
Pego1.GraphAnnotationX(11) = 0
Pego1.GraphAnnotationY(11) = 0
Pego1.GraphAnnotationType(11) = PEGAT_ADDTEXT
Pego1.GraphAnnotationColor(11) = 0
Pego1.GraphAnnotationText(11) = "Col1
Col2" + Chr$(10)
Pego1.GraphAnnotationX(12) = 0
Pego1.GraphAnnotationY(12) = 0
Pego1.GraphAnnotationType(12) = PEGAT_ADDTEXT
Pego1.GraphAnnotationColor(12) = 0
Pego1.GraphAnnotationText(12) = "on
off" + Chr$(10)
Pego1.GraphAnnotationX(13) = 7.75
Pego1.GraphAnnotationY(13) = 1050
Pego1.GraphAnnotationType(13) = PEGAT_PARAGRAPH
Pego1.GraphAnnotationColor(13) = Pego1.PEargb(255, 88, 88,
88)

Pego1.GraphAnnotationText(13) = ""
Pego1.GraphAnnotationFont(13) = "Courier New"
'// Draw an Arrow Pointer annotation //
Pego1.GraphAnnotationX(14) = 2.5

Pego1.GraphAnnotationY(14) = 1130
Pego1.GraphAnnotationType(14) = PEGAT_POINTER_ARROW_MEDIUM
Pego1.GraphAnnotationColor(14) = Pego1.PEargb(255, 0, 198,

198)

Pego1.GraphAnnotationText(14) = "Move toward Start"


Pego1.GraphAnnotationShadow(14) = True
'// Draw an Arrow annotation //
Pego1.GraphAnnotationX(15) = 1.5
Pego1.GraphAnnotationY(15) = 1250
Pego1.GraphAnnotationType(15) = PEGAT_THIN_SOLIDLINE
Pego1.GraphAnnotationColor(15) = Pego1.PEargb(128, 128, 200,
198)

Pego1.GraphAnnotationText(15) = ""
Pego1.GraphAnnotationX(16) = 2.5
Pego1.GraphAnnotationY(16) = 1290
Pego1.GraphAnnotationType(16) = PEGAT_ARROWSOLID_SMALL
Pego1.GraphAnnotationColor(16) = Pego1.PEargb(128, 128, 200,

198)

Pego1.GraphAnnotationText(16) = ""
'// Place a symbol with respect to right y axis //
Pego1.GraphAnnotationX(17) = 11.5
Pego1.GraphAnnotationY(17) = 900
Pego1.GraphAnnotationType(17) = PEGAT_SMALLDOTSOLID + 1000
1000 designates on right axis
Pego1.GraphAnnotationColor(17) = Pego1.PEargb(255, 88, 88,
88)
Pego1.GraphAnnotationText(17) = "900 Right Axis"
Pego1.GraphAnnotationGradientStyle(17) =
PEPGS_VERTICAL_ASCENT_INVERSE
Pego1.GraphAnnotationShadow(17) = True
'// Draw Angled Text Annotation //
Pego1.GraphAnnotationX(18) = 1.5
Pego1.GraphAnnotationY(18) = 1250
Pego1.GraphAnnotationType(18) = PEGAT_NULL_PEN
Pego1.GraphAnnotationColor(18) = Pego1.PEargb(0, 0, 0, 0)
Pego1.GraphAnnotationText(18) = ""
'// Draw an Arrow annotation //
Pego1.GraphAnnotationX(19) = 2.5
Pego1.GraphAnnotationY(19) = 1290
Pego1.GraphAnnotationType(19) = PEGAT_ANGLED_TEXT
Pego1.GraphAnnotationColor(19) = Pego1.PEargb(255, 88, 88,
88)

Pego1.GraphAnnotationText(19) = "Hello"
'// Show annotations shadows //
Pego1.GraphAnnotationShadows = True

'

'// Allow user to move ArrowPointer annotation //


Pego1.GraphAnnotMoveable = PEGAM_POINTER
Pego1.AllowGraphAnnotHotSpots = True
'// Other various properties //
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_DARK_INSET
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 16 Then
'****************************************************************
*****'
'****************************************************************
*****'
'016 Graph showing date time handling
'//! This examples shows Date/Time handling vith the Graph
Object.
'//! The Graph is suited to show discontinuous date/time
scales.
'//! Discontinuous for example, 8am to 5pm, Monday to Friday.
'//! Here's a tip, when debugging your data-passing logic,
use the
'//! built-in text export feature to verify that data is as
'//! expected.
'// Enable Mouse Wheel and Pinch Smoothing //
Pego1.MouseWheelZoomSmoothness = 5
Pego1.PinchZoomSmoothness = 2
Pego1.MouseWheelZoomFactor = 1.4
Pego1.PinchZoomFactor = 1.15
'// Enable MouseWheel Zooming
Pego1.MouseWheelFunction = 4
'// Enable ZoomWindow Feature //
Pego1.ZoomWindow = True
'// Enable middle mouse dragging //
Pego1.MouseDraggingX = True
Pego1.MouseDraggingY = True
'// Enable Plotting style bevel features //
Pego1.AreaBevelStyle = PEBS_THIN_SMOOTH
Pego1.SplineBevelStyle = PESBS_THIN_SMOOTH
Pego1.AreaBorder = 1
Pego1.AllowSvgExport = True

Pego1.Subsets = 2
Pego1.Points = 60000
'// Set Date Time Handling related properties //
Pego1.DeltaX = 5
'// 5 minutes between data points
Pego1.DeltasPerDay = 96 '// 96 data points in one day
Pego1.StartTime = 0.3333333333334
Pego1.UsingXDataII = True
Dim d As Double
Dim i As Integer
'// PreAllocates memory, best to use PEvset like in exp 018
but for simplicity we spoon feed.
'// Setting last point first helps spoon feeding large data
sets.
Pego1.XDataII(0, 59999) = 0 ' Note pego xdata datetimemode
only uses 1 subset, thus index 0
Pego1.YData(1, 59999) = 0
' ydata uses 2 subsets, thus last
point is index 1, point 59999
d = CLng(Now) - 700
For p = 0 To 59999
Pego1.YData(0, p) = 55 + (Rnd() * 55) + (Sin(p * 0.0003)
* 500)
Pego1.YData(1, p) = 5 + (Rnd() * 55) + (Sin(p * 0.003) *
400)
'//! The toughest
Object is
'//! to make sure
XData is
'//! DeltaX apart
data points
'//! in each day.
Daily/Weekly/Monthly
'//! data is much

thing about DateTimeMode within Graph


your XData is constructed so that every
and there are DeltasPerDay worth of
Well, at least for intraday data.
easier to work with.

'//! Also note that if you do not set XData,


ProEssentials will
'//! automatically construct your XData with respect to
the
'//! AutoXData, DeltaX, StartTime, and DeltasPerDay
properties.
'// Construct XDataII to match parameters above //
Pego1.XDataII(0, p) = d + 0.333333333333333 + (((i *
5#) / 60#) / 24#)
'// every 5 minutes, 60 minutes in an hour, 24 hours in a
day

i = i + 1
If (i >= 96) Then
i = 0
d = d + 1
End If
Next p
'// This empties PointLabels array and invokes virtual point
labels //
'// which are the point number.
Pego1.PointLabels(-1) = "0"
'// You can modify date label formats with //
Pego1.YearMonthDayPrompt = PEDP_INSIDE_TOP
'// PEP_nTIMELABELTYPE
'// PEP_nDAYLABELTYPE
'// PEP_nMONTHLABELTYPE
'// PEP_nYEARLABELTYPE
'// Enable DateTimeMode //
Pego1.DateTimeMode = PEDTM_VB
'// Enable Zooming, zoom the chart and see how structure //
'// of x axis changes as you zoom //
Pego1.AllowZooming = PEAZ_HORIZONTAL
'// Set various properties //
Pego1.PrepareImages = True
Pego1.DataShadows = PEDS_NONE
Pego1.GridLineControl = PEGLC_BOTH
Pego1.FocalRect = False
Pego1.FixedFonts = True
Pego1.ZoomStyle = PEZS_RO2_NOT
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_LIGHT_LINE
Pego1.GradientBars = 8
Pego1.LineShadows = True
Pego1.MainTitleBold = True
Pego1.SubTitleBold = True
Pego1.LabelBold = True
Pego1.TextShadows = PETS_BOLD_TEXT
Pego1.FontSize = PEFS_MEDIUM
Pego1.ScrollingScaleControl = True
Pego1.PlottingMethod = GPM_AREA
Pego1.SolidLineOverArea = 1
Pego1.NoHiddenLinesInArea = True
Pego1.SubsetColors(0) = Pego1.PEargb(175, 198, 0, 0)
Pego1.SubsetColors(1) = Pego1.PEargb(85, 0, 0, 198)

Pego1.SubsetGradientStyle(0) = PEPGS_RADIAL_TOP_LEFT
Pego1.SubsetGradientStyle(1) = PEPGS_RADIAL_BOTTOM_RIGHT
'// Set various export defaults //
Pego1.DpiX = 600
Pego1.DpiY = 600
Pego1.ExportSizeDef = PEESD_NO_SIZE_OR_PIXEL
Pego1.ExportTypeDef = PEETD_PNG
Pego1.ExportDestDef = PEEDD_CLIPBOARD
Pego1.ExportUnitXDef = "1280"
Pego1.ExportUnitYDef = "768"
Pego1.ExportImageDpi = 300
Pego1.AllowSvgExport = True
Pego1.RenderEngine = PERE_DIRECT2D
Pego1.AntiAliasGraphics = True
Pego1.AntiAliasText = True
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 17 Then
'****************************************************************
*****'
'****************************************************************
*****'
'017 Graph showing real-time data handling
'// No Shadows //
Pego1.DataShadows = PEDS_NONE
'// No Flicker //
Pego1.PrepareImages = True
Pego1.CacheBmp = True
'// Set Subsets and Points //
Pego1.Subsets = 2
'// set number of subsets
'// Set number data points
Pego1.Points = 200
'// number of data points
Pego1.PointsToGraph = 200
Pego1.PointsToGraphInit = PEPTGI_LASTPOINTS
Pego1.PlottingMethod = GPM_POINTSPLUSLINE
'// subset line types
Pego1.SubsetLineTypes(0) = PELT_THIN_SOLID
Pego1.SubsetLineTypes(1) = PELT_THIN_SOLID
'// subset point types
Pego1.SubsetPointTypes(0) = PEPT_SQUARESOLID
Pego1.SubsetPointTypes(1) = PEPT_PLUS

'// Not ideal for real-time, but nice for


presentation/demonstration
Pego1.PointGradientStyle = PEPGS_VERTICAL_ASCENT_INVERSE
Pego1.PointBorderColor = Pego1.PEargb(100, 0, 0, 0)
'// Main Title
Pego1.MainTitle = "Simple Graph Real Time"
Pego1.SubTitle = ""
'// no subtitle
'// Manually configure scales //
Pego1.ManualScaleControlY = PEMSC_MINMAX
Pego1.ManualMinY = 1#
Pego1.ManualMaxY = 100
Pego1.ManualMinY = 1
Pego1.ManualMaxDataString = "000.000"
Pego1.ManualMaxPointLabel = "00:00:00xx"
Pego1.NoStackedData = True
Pego1.NoRandomPointsToGraph = True
Pego1.AllowHistogram = False
Pego1.FocalRect = False
Pego1.GridLineControl = PEGLC_BOTH
Pego1.DataPrecision = 1
'// Needed to allocate point labels so append logic works //
'// Set last point label, Points - 1 //
Pego1.PointLabels(199) = ""
Pego1.YData(0,
Pego1.YData(0,
Pego1.YData(0,
Pego1.YData(0,

0)
1)
2)
3)

=
=
=
=

0
0
0
0

If (Pego1.IsDxAvailable = True) Then


Pego1.BitmapGradientMode = True
Else
Pego1.BitmapGradientMode = False
End If
Pego1.QuickStyle = PEQS_DARK_NO_BORDER
Pego1.FixedFonts = True
Pego1.MainTitleBold = True
Pego1.SubTitleBold = True
Pego1.LabelBold = True
Pego1.TextShadows = PETS_BOLD_TEXT
Pego1.FontSize = PEFS_MEDIUM
Pego1.GridStyle = PEGS_DOT
Pego1.SubsetColors(0) = Pego1.PEargb(128, 0, 198, 0)
Pego1.SubsetColors(1) = Pego1.PEargb(128, 145, 145, 145)

Pego1.RenderEngine = PERE_DIRECT2D
Pego1.AntiAliasText = True
Pego1.AntiAliasGraphics = True
'// Set various export defaults //
Pego1.DpiX = 600
Pego1.DpiY = 600
Pego1.ExportSizeDef = PEESD_NO_SIZE_OR_PIXEL
Pego1.ExportTypeDef = PEETD_PNG
Pego1.ExportDestDef = PEEDD_CLIPBOARD
Pego1.ExportUnitXDef = "1280"
Pego1.ExportUnitYDef = "768"
Pego1.ExportImageDpi = 300
Pego1.AllowSvgExport = True
Pego1.PEactions = REINITIALIZE_RESETIMAGE
Timer1.Interval = 25
Timer1.Enabled = True
'////////////////////////////////////////////////////////
'// the following code can be found in the Timer Event //
'////////////////////////////////////////////////////////
Dim CurrentTime As String
Dim test As Long

'
'
'
'
'// new point label //
'
CurrentTime = Time$
'
'
'// new YData //
'
ReDim NewData(2) As Single
'
NewData(0) = (Rnd * 20) + 2
'
NewData(1) = (Rnd * 40) + 60
'
'
'// transfer new point label //
'
Call PEvset(Pego1.hObject, PEP_szaAPPENDPOINTLABELDATA, ByVal
CurrentTime, 1)
'
'
'// transfer new YData //
'
'// this will also update and view new image //
'
test = PEvset(Pego1.hObject, PEP_faAPPENDYDATA, NewData(0),
1)
ElseIf nChart = 18 Then
'****************************************************************
*****'
'****************************************************************
*****'
'018 Graph showing use of PEvset

'// This example builds upon the basic CreateSimpleGraph '000'


example chart //
Call CreateSimpleGraph
'// Repass the data, this time with PEvset call //
ReDim MyYData(48) As Single ' 4 * 12 = 48
Dim o As Integer
Dim result As Long
For s = 0 To 3
For p = 0 To 11
o = (s * 12) + p ' 12 = Points property
MyYData(o) = 5 + (Rnd * 10)
Next p
Next s
result = PEvset(Pego1, PEP_faYDATA, MyYData(0), 48)
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 19 Then
'****************************************************************
*****'
'****************************************************************
*****'
'019 Graph showing large quantity of data
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
'// Enable ZoomWindow //
Pego1.ZoomWindow = True
Pego1.AllowZooming = PEAZ_HORIZONTAL
Pego1.MouseWheelFunction = PEMWF_HORZ_ZOOM
Pego1.MouseWheelZoomSmoothness = 5
Pego1.PinchZoomSmoothness = 2
'// Disable some features not ideal for larger data sets.
Pego1.PointGradientStyle = PEPGS_NONE
Pego1.PointBorderColor = Pego1.PEargb(0, 0, 0, 0)
Pego1.LineSymbolThickness = 0
'// Repass the data, this time with PEvset call //
Pego1.Subsets = 1
Pego1.Points = 100000
'// Prepare data in temp array, make sure it is Single (4
byte floats) **'
ReDim MyYData(100000) As Single
Dim j As Long

Dim k As Long
For j = 0 To 99999
MyYData(j) = (Sin(0.0003 * j) * 500#)
Next j
'// Change some of the data so we can see some //'
'// variations in data //'
For j = 0 To 99999 Step 10000
For k = 0 To 5000
MyYData(j + k) = MyYData(j + k) - 50 + (Rnd * 100)
Next k
Next j
'// Perform the actual transfer of data //'
Call PEvset(Pego1, PEP_faYDATA, MyYData(0), 100000)
'// This empties PointLabels array and invokes virtual point
labels //'
'// which are the point number.
Pego1.PointLabels(-1) = "0"
'// Set plotting method to line and allow zooming //'
Pego1.PlottingMethod = GPM_LINE
Pego1.AllowPlotCustomization = False
'// This allows plotting of zero values //'
Pego1.NullDataValue = -99999
Pego1.SubsetLineTypes(0) = PELT_THINSOLID
Pego1.MarkDataPoints = False
Pego1.BitmapGradientMode = False
Pego1.QuickStyle = PEQS_LIGHT_SHADOW
Pego1.DataShadows = PEDS_NONE
If (Pego1.IsDxAvailable) Then
Pego1.RenderEngine = PERE_DIRECT3D
Pego1.Force3dxNewColors = True
Pego1.Force3dxVerticeRebuild = True
Else
Pego1.RenderEngine = PERE_DIRECT2D
End If
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 20 Then
'****************************************************************
*****'
'****************************************************************
*****'
'020 Graph showing Real-Time PEpartialresetimage

'//! Rarely needed but can help when application needs many
charts, each with many points, all updating.
'// No Flicker //
Pego1.PrepareImages = True
Pego1.CacheBmp = True
'//! Important for
PEpartialresetimage to work.
Pego1.AutoImageReset = False
'//! Also important for this
type of real-time
Pego1.SpeedBoost = 0
Pego1.HourGlassThreshold = 40000
'// Set Subsets and Points //
Pego1.Subsets = 2
Pego1.Points = 15000
//

'// Pass 80% of the

data, first one subset, then next subset

ReDim MyYData(12000) As Single


For p = 0 To 11999
MyYData(p) = (Sin(0.003 * p) * 500#) + (Rnd() * 50)
Next p
'// Perform the actual transfer of data, first subset //
Call PEvsetEx(Pego1.hObject, PEP_faYDATA, 0, 12000,
MyYData(0), 0)
Randomize (Now)
For p = 0 To 11999
MyYData(p) = (Cos(0.003 * p) * 500#) + (Rnd() * 50)
Next p
'// Perform the actual transfer of data, second subset //
Call PEvsetEx(Pego1.hObject, PEP_faYDATA, 15000, 12000,
MyYData(0), 0)
'// Setting last point label first allocates memory and
speeds up subsequent logic //'
Pego1.PointLabels(11999) = " "
For p = 0 To 11999
Pego1.PointLabels(p) = "Test" + Str$(p + 1)
Next p
'// Set up two axes, just because it's easy ///
Pego1.MultiAxesSubsets(0) = 1
Pego1.MultiAxesSubsets(1) = 1
Pego1.MultiAxisStyle = PEMAS_SEPARATE_AXES
'// Manually configure top scale scale //

Pego1.WorkingAxis = 0
Pego1.ManualScaleControlY = PEMSC_MINMAX
Pego1.ManualMinY = -600
Pego1.ManualMaxY = 600
'// Manually configure bottom scale scale //
Pego1.WorkingAxis = 1
Pego1.ManualScaleControlY = PEMSC_MINMAX
Pego1.ManualMinY = -600
Pego1.ManualMaxY = 600
'// Real-Time related properties for Graph Objects //
Pego1.ManualMaxPointLabel = "Test XXXXXXX"
Pego1.ManualMaxDataString = "12345"
'// Set Various Other Properties //
Pego1.MainTitle = "Graph Real Time Example"
Pego1.SubTitle = "" '// no subtitle
Pego1.PlottingMethod = PEGPM_LINE
Pego1.AllowPlotCustomization = False
Pego1.FocalRect = False
Pego1.GridLineControl = PEGLC_NONE
Pego1.DataPrecision = 1
Pego1.FixedFonts = True
Pego1.FontSize = PEFS_MEDIUM
Pego1.SubsetLineTypes(0) = PELT_THIN_SOLID
Pego1.SubsetLineTypes(1) = PELT_THIN_SOLID
Pego1.AllowZooming = PEAZ_HORZANDVERT
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_DARK_NO_BORDER
Pego1.SubsetColors(0) = Pego1.PEargb(255, 0, 198, 0)
Pego1.SubsetColors(1) = Pego1.PEargb(255, 198, 0, 198)
Pego1.LegendStyle = PELS_1_LINE_INSIDE_AXIS
Pego1.GridLineControl = PEGLC_YAXIS
Pego1.MultiAxesSizing = True
Pego1.BorderTypes = PETAB_INSET
Pego1.ZoomStyle = PEZS_FRAMED_RECT
'// Set various export defaults //
Pego1.DpiX = 600
Pego1.DpiY = 600
Pego1.ExportSizeDef = PEESD_NO_SIZE_OR_PIXEL
Pego1.ExportTypeDef = PEETD_PNG
Pego1.ExportDestDef = PEEDD_CLIPBOARD
Pego1.ExportUnitXDef = "1280"
Pego1.ExportUnitYDef = "768"

Pego1.ExportImageDpi = 300
Pego1.AllowSvgExport = True
Pego1.RenderEngine = PERE_HYBRID
m_nRealTimeCounter = 12000
m_nSinCounter = 12000
Pego1.PEactions = REINITIALIZE_RESETIMAGE
Timer1.Interval = 50
Timer1.Enabled = True
'////////////////////////////////////////////////////////
'// the following code can be found in the Timer Event //
'////////////////////////////////////////////////////////
'// Graph Real Time Feed using PEpartialresetimage //
'
If m_nRealTimeCounter >= 15000 Then
'
'// When we reach the end of our data, we shift 20% to
the
'
'// left and make room for another 3000 quick updates.
'
ReDim NewData(6000) As Single
'
Call PEvset(Pego1.hObject, PEP_szaAPPENDPOINTLABELDATA,
ByVal 0&, 3000)
'
Call PEvset(Pego1.hObject, PEP_faAPPENDYDATA, NewData(0),
3000)
'
'
'// We need to perform a complete image update here.
'
Pego1.PEactions = RESET_IMAGE
'
Pego1.PEactions = INVALIDATE_RECT
'
Call UpdateWindow(Pego1.hWnd)
'
'
m_nRealTimeCounter = 12000
'
End If
'
'
'// First Subset //
'
Pego1.YData(0, m_nRealTimeCounter) = (Sin(0.003 *
m_nSinCounter) * 500#)
'
'
'// Second Subset //
'
Pego1.YData(1, m_nRealTimeCounter) = (Cos(0.003 *
m_nSinCounter) * 500#)
'
'
'// Set an example string associated with data //
'
Pego1.PointLabels(m_nRealTimeCounter) = "Test" + Str$
(m_nSinCounter)
'
'
'// This call performs a quick partial draw to an internal
cached bmp //'
'
Pego1.PEpartialresetimage m_nRealTimeCounter, 1

'
'
'// Invalidate control, only invalidate vertical charting
area and
'
'// approximate horizontal location of new data added.
'
Dim nA As Long
'
Dim nX As Long
'
Dim nY As Long
'
Dim fX As Double
'
Dim fY As Double
'
Dim nTop As Integer
'
Dim nLeft As Integer
'
Dim nRight As Integer
'
Dim nBottom As Integer
'
Dim r As Rect
'
'
nA = 0
'// Initialize axis, non-zero only if using
MultiAxesSubsets
'
fX = m_nRealTimeCounter - 5#
'// Approximate horizontal
location
'
fY = 0
'// not important, we will user vertical extents
from PEP_rectGRAPH
'
'
'// This call finds pixel location for fX and fY graph
coordinates //'
'
Pego1.PEconvpixeltograph nA, nX, nY, fX, fY, 0, 0, 1
'
'
'// get vertical extents of charting area //'
'
Pego1.GetRectGraph nLeft, nTop, nRight, nBottom
'
nLeft = nX
'
nRight = nX + 50 '// 50 pixels close to new data location
'
'
'// For comparison purposes, you can uncomment the line
below //
'
'// Calling PEresetimage with each timer event causes CPU
usage to go to 100%
'
'// PEpartialresetimage allows the same visual output while
using 2% or less of the CPU
'
'// Pego1.PEresetimage 0, 0
'
'
'// Call Windows API to only invalidate what needs
invalidating //'
'
r.left = nLeft
'
r.Top = nTop
'
r.bottom = nBottom
'
r.right = nRight
'
'
Call InvalidateRect(Pego1.hWnd, r, False)
'
'
m_nRealTimeCounter = m_nRealTimeCounter + 1
'
m_nSinCounter = m_nSinCounter + 1
ElseIf nChart = 21 Then

'****************************************************************
*****'
'****************************************************************
*****'
'021 Graph showing Hatching
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
Pego1.SubsetHatch(0)
Pego1.SubsetHatch(1)
Pego1.SubsetHatch(2)
Pego1.SubsetHatch(3)

=
=
=
=

PEHS_BDIAGONAL
PEHS_CROSS
PEHS_DIAGCROSS
PEHS_FDIAGONAL

'// Set Other Various Properties //


Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_DARK_NO_BORDER
Pego1.BorderTypes = PETAB_SINGLE_LINE
'// Enable Stacked type charts //
Pego1.NoStackedData = False
'// Set plotting method //
Pego1.PlottingMethod = GPM_BARSTACKED
Pego1.HatchBackColor = Pego1.PEargb(25, 0, 0, 0)
Pego1.DataShadows = PEDS_NONE
Pego1.BarGlassEffect = False
Pego1.SubsetColors(0)
Pego1.SubsetColors(1)
Pego1.SubsetColors(2)
Pego1.SubsetColors(3)

=
=
=
=

Pego1.PEargb(228,
Pego1.PEargb(228,
Pego1.PEargb(228,
Pego1.PEargb(228,

198, 0, 0)
0, 198, 198)
198, 138, 0)
0, 198, 0)

'// Add a table //


Pego1.GraphPlusTable = PEGPT_BOTH
Pego1.DataPrecision = 0
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 22 Then
'****************************************************************
*****'
'****************************************************************
*****'
'022 Graph Mixing Plotting Methods per Subset
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
'//! This is a new method of setting plotting methods in

version 4 //'
'// Set plotting method per subset //
Pego1.PlottingMethods(0) = PEGPM_HIGHLOWAREA
Pego1.PlottingMethods(1) = PEGPM_HIGHLOWAREA
Pego1.PlottingMethods(2) = PEGPM_LINE
Pego1.PlottingMethods(3) = PEGPM_BAR
'// Set Subset Labels for High Low //
Pego1.SubsetLabels(0) = "High"
Pego1.SubsetLabels(1) = "Low"
'// Set Other Various Properties //
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_LIGHT_LINE
Pego1.PlotMethodMenu = PEMC_HIDE
'// Make the line types bold //
Pego1.SubsetLineTypes(0) = PELT_MEDIUMSOLID
Pego1.SubsetLineTypes(1) = PELT_MEDIUMSOLID
Pego1.SubsetLineTypes(2) = PELT_THICKDOT
'// Change the Bar's color //
Pego1.SubsetColors(3) = Pego1.PEargb(32, 0, 0, 150)
'// Add a table //
Pego1.GraphPlusTable = PEGPT_BOTH
Pego1.DataPrecision = 0
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 23 Then
'****************************************************************
*****'
'****************************************************************
*****'
'023 Graph Showing Bitmap and Gradients
'//! Top image is Tiled within axis area. //
'//! Bottom image is StretchBlt'ed within axis area. //
'//! Click bottom of top axis and drag to resize axes. //
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
Pego1.BitmapGradientMode = True
Pego1.DeskColor = 1 '// 1 means transparent, no RGB fill
Pego1.DeskGradientStart = Pego1.PEargb(255, 0, 0, 110)
Pego1.DeskGradientEnd = Pego1.PEargb(255, 0, 0, 220)
Pego1.DeskGradientStyle = PEGS_VERTICAL
Pego1.DeskBmpFilename = App.Path + "\gigasoft.jpg"

Pego1.DeskBmpStyle = PEBS_BITBLT_TOP_RIGHT
'// Now sub-divide subsets into 2 individual axes //
'// Each axis with a bitmap //
Pego1.Subsets = 2
Pego1.MultiAxesSubsets(0) = 1
Pego1.MultiAxesSubsets(1) = 1
Pego1.LegendStyle = PELS_1_LINE_INSIDE_AXIS
'// Set first axis parameters //
Pego1.WorkingAxis = 0
Pego1.GraphBackColor = 1 '// 1 means transparent, no RGB fill
Pego1.GraphBmpFilename = App.Path + "\darkcir.jpg"
Pego1.GraphBmpStyle = PEBS_TILED_BITBLT
Pego1.YAxisLabel = "Research"
Pego1.SubsetLabels(0) = "Research"
Pego1.PlottingMethod = GPM_POINTSPLUSSPLINE
'// Set second axis parameters //
Pego1.WorkingAxis = 1
Pego1.GraphBackColor = 1 '// 1 means transparent, no RGB
fill

Pego1.GraphBmpFilename = App.Path + "\demo2.png"


Pego1.GraphBmpStyle = PEBS_STRETCHBLT
Pego1.YAxisLabel = "Reward"
Pego1.SubsetLabels(1) = "Reward"
Pego1.PlottingMethod = GPM_POINTSPLUSSPLINE
'// Reset WorkingAxis when done //
Pego1.WorkingAxis = 0
'// Set Various Other Properties //
Pego1.MainTitle = ""
Pego1.SubTitle = ""
'// Add some padding around image //
Pego1.ImageAdjustTop = 650
Pego1.ImageAdjustBottom = 100
Pego1.ImageAdjustLeft = 100
Pego1.ImageAdjustRight = 100
Pego1.TickColor = 1 '// 1 means match GraphForeColor
Pego1.DataShadows = PEDS_3D
Pego1.GraphForeColor = Pego1.PEargb(255, 128, 128, 128)
'// Make the line types bold //
Pego1.SubsetLineTypes(0) = PELT_MEDIUM_SOLID
Pego1.SubsetLineTypes(1) = PELT_MEDIUM_SOLID
Pego1.SubsetLineTypes(2) = PELT_MEDIUM_SOLID
Pego1.SubsetLineTypes(3) = PELT_MEDIUM_SOLID

Pego1.MultiAxisStyle = PEMAS_SEPARATE_AXES
Pego1.MultiAxesSizing = True
Pego1.FontSize = PEFS_LARGE
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 24 Then
'****************************************************************
*****'
'****************************************************************
*****'
'024 Graph showing Background Bitmap
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
Pego1.BitmapGradientMode = True
Pego1.DeskColor = 1 '// 1 means transparent, no RGB fill
Pego1.DeskBmpFilename = App.Path + "\cloud.jpg"
Pego1.DeskBmpStyle = PEBS_TILED_BITBLT
Pego1.GraphForeColor = Pego1.PEargb(255, 0, 0, 0)
Pego1.TextColor = Pego1.PEargb(255, 0, 0, 0)
'// Now sub-divide subsets into 2 axes //
'// Each axis to be transarent //
Pego1.MultiAxesSubsets(0) = 2
Pego1.MultiAxesSubsets(1) = 2
Pego1.LegendStyle = PELS_1_LINE_INSIDE_AXIS
Pego1.MultiAxesSizing = True
'// Set first axis parameters //
Pego1.WorkingAxis = 0
Pego1.YAxisLabel = ""
Pego1.PlottingMethod = GPM_POINTSPLUSLINE
Pego1.GraphBackColor = 1 '// 1 means transparent, no RGB fill
Pego1.GraphGradientStyle = PEGS_NO_GRADIENT
'// Set second axis parameters //
Pego1.WorkingAxis = 1
Pego1.YAxisLabel = ""
Pego1.PlottingMethod = GPM_BAR
Pego1.GraphBackColor = 1 '// 1 means transparent, no RGB fill
Pego1.GraphGradientStyle = PEGS_NO_GRADIENT
'// Reset WorkingAxis when done //
Pego1.WorkingAxis = 0
'// Set Various Other Properties //
Pego1.MainTitle = ""

Pego1.SubTitle = ""
Pego1.MultiAxisStyle = PEMAS_SEPARATE_AXES
Pego1.TickColor = 1 '// 1 means use GraphForeColor
Pego1.DataShadows = PEDS_3D
Pego1.FixedFonts = True
Pego1.MainTitleBold = True
Pego1.LabelBold = True
Pego1.BorderTypes = PETAB_NO_BORDER
Pego1.PointSize = PEPS_LARGE
Pego1.GridLineControl = PEGLC_BOTH
Pego1.GridStyle = PEGS_DOT
'// Make the line types bold //
Pego1.SubsetLineTypes(0) = PELT_MEDIUM_SOLID
Pego1.SubsetLineTypes(1) = PELT_MEDIUM_SOLID
Pego1.SubsetLineTypes(2) = PELT_MEDIUM_SOLID
Pego1.SubsetLineTypes(3) = PELT_MEDIUM_SOLID
'// Add some padding around image //
Pego1.ImageAdjustTop = 100
Pego1.ImageAdjustBottom = 100
Pego1.ImageAdjustLeft = 100
Pego1.ImageAdjustRight = 100
Pego1.GraphPlusTable = PEGPT_GRAPH
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 25 Then
'****************************************************************
*****'
'****************************************************************
*****'
'025 Graph showing Floating Stacked Bars
'//! Try this... Right Click chart and change the Plotting
Method to Horizontal Bar Stacked. //
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
'// Enable Stacked type charts //
Pego1.NoStackedData = False
Pego1.AllowHorzBarStacked = True
'// Set plotting method //
Pego1.PlottingMethod = PEGPM_BARSTACKED
'// Floating stacked Bars are constructed by setting ZData //
For p = 0 To 11

Pego1.ZData(0, p) = Abs(Sin((0.3 * p)) * 800#) + 400


Next p
'// Enable floating stacked bar feature //
Pego1.FloatingStackedBars = True
'// Set Various Other Properties ///
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_LIGHT_SHADOW
Pego1.GridLineControl = PEGLC_BOTH
Pego1.GridStyle = PEGS_DOT
Pego1.GraphPlusTable = PEGPT_BOTH
Pego1.GridInFront = True
Pego1.DataPrecision = 0
Pego1.DataShadows = PEDS_3D
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 26 Then
'****************************************************************
*****'
'****************************************************************
*****'
'026 Graph showing Table Annotations, Simple
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
'// Construct a simple table annotation //
Pego1.WorkingTable = 0
Pego1.TARows = 4
Pego1.TAColumns = 7
Pego1.TATextSize = 85
'// Pass the table
Pego1.TAText(1, 0)
Pego1.TAText(2, 0)
Pego1.TAText(3, 0)

text //
= " 1 "
= " 2 "
= " 3 "

Pego1.TAText(0,
Pego1.TAText(0,
Pego1.TAText(0,
Pego1.TAText(0,
Pego1.TAText(0,
Pego1.TAText(0,

=
=
=
=
=
=

1)
2)
3)
4)
5)
6)

"Try not "


"... "
"Do "
"... "
"or "
"Do not "

Dim r As Integer
Dim c As Integer
For r = 1 To 3
For c = 1 To 6
Pego1.TAText(r, c) = Format$((Sin(0.3 * c + 1) *

500#) + (Rnd() * 50), "###0.000 ")


Pego1.TAColor(r, c) = Pego1.PEargb(255, 0, 0, 0)
Next c
Next r
'// Other Table Related Properties ///
Pego1.ShowTableAnnotation = True
Pego1.TALocation = PETAL_INSIDE_TOP_LEFT
Pego1.TABackColor = Pego1.PEargb(5, 150, 150, 150)
Pego1.TAGradientStyle = PEPGS_VERTICAL_ASCENT
Pego1.TAGradientColor = Pego1.PEargb(255, 255, 255, 255)
Pego1.TABevelStyle = PEBS_THIN_SMOOTH
Pego1.TABorder = PETAB_NO_BORDER
Pego1.TAHeaderRows = 1
Pego1.TAHeaderColumn = True
'// Construct a second simple table annotation //
Pego1.WorkingTable = 1
Pego1.TARows = 15
Pego1.TAColumns = 2
'// Pass the table text //
Pego1.TAText(0, 0) = ""
Pego1.TAText(0, 1) = "Data"
Pego1.TAJustification(0, 0) = PETAJ_CENTER
Pego1.TAJustification(0, 1) = PETAJ_CENTER
'// First Column Text //
For r = 1 To 14
Pego1.TAText(r, 0) = Str$(r)
Next r
'// Second Column Text //
For r = 1 To 14
Pego1.TAText(r, 1) = Format$((Sin(0.3 * r + 1) * 500#) +
(Rnd() * 50), "###0.00")
Next r
'// Other Table Related Properties ///
Pego1.ShowTableAnnotation = True
Pego1.TALocation = PETAL_LEFT_CENTER
Pego1.TABackColor = Pego1.PEargb(50, 255, 255, 255)
Pego1.TABevelStyle = PEBS_THIN_SMOOTH
Pego1.TABorder = PETAB_NO_BORDER
Pego1.TAHeaderRows = 1
Pego1.TAHeaderColumn = True
'// Done setting Table Annotations ///
'// Set Various Other Properties ///

Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_LIGHT_NO_BORDER
Pego1.DataPrecision = 0
Pego1.GridInFront = True
Pego1.PlottingMethod = GPM_POINTSPLUSLINE
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 27 Then
'****************************************************************
*****'
'****************************************************************
*****'
'027 Graph showing Table Annotations, Stacked
'// This example builds upon the basic CreateSimpleGraph '000'
example chart //
Call CreateSimpleGraph
'/////////////////////////////////////////
'// Construct a simple table annotation //
'/////////////////////////////////////////
Pego1.WorkingTable = 0
Pego1.TARows = 1
Pego1.TAColumns = 2
Pego1.TATextSize = 85
'// Pass the table text //
Pego1.TAText(0, 0) = "Category 1"
Pego1.TAText(0, 1) = "Category 2"
'// Set column widths //
Pego1.TAColumnWidth(0) =
Pego1.TAColumnWidth(1) =
Pego1.TAJustification(0,
Pego1.TAJustification(0,

28
28
0) = PETAJ_CENTER
1) = PETAJ_CENTER

Pego1.ShowTableAnnotation = True
Pego1.TALocation = PETAL_INSIDE_AXIS_0
Pego1.TAAxisLocation = PETAAL_TOP_LEFT
Pego1.TABorder = PETAB_SINGLE_LINE
Pego1.TABackColor = Pego1.PEargb(55, 255, 255, 255)
Pego1.TAGradientStyle = PEPGS_VERTICAL
'/////////////////////////////////////////
'// Construct a simple table annotation //
'/////////////////////////////////////////
Pego1.WorkingTable = 1
Pego1.TARows = 1

Pego1.TAColumns = 4
Pego1.TATextSize = 85
Pego1.TAText(0, 0) = "Sub Cat
Pego1.TAText(0, 1) = "Sub Cat
Pego1.TAText(0, 2) = "Sub Cat
Pego1.TAText(0, 3) = "Sub Cat
Pego1.TAColumnWidth(0) = 14
Pego1.TAColumnWidth(1) = 14
Pego1.TAColumnWidth(2) = 14
Pego1.TAColumnWidth(3) = 14
Pego1.TAJustification(0, 0) =
Pego1.TAJustification(0, 1) =
Pego1.TAJustification(0, 2) =
Pego1.TAJustification(0, 3) =

1"
2"
3"
4"

PETAJ_CENTER
PETAJ_CENTER
PETAJ_CENTER
PETAJ_CENTER

Pego1.TABackColor = Pego1.PEargb(55, 240, 240, 240)


Pego1.TAGradientStyle = PEPGS_VERTICAL
Pego1.ShowTableAnnotation = True
Pego1.TALocation = PETAL_INSIDE_AXIS_0
Pego1.TAAxisLocation = PETAAL_TOP_LEFT + PETAAL_NEW_ROW
Pego1.TABorder = PETAB_SINGLE_LINE
'/////////////////////////////////////////
'// Construct a simple table annotation //
'/////////////////////////////////////////
Pego1.WorkingTable = 2
Pego1.TARows = 4
Pego1.TAColumns = 8
Pego1.TATextSize = 85
'// Set Column Widths //
Pego1.TAColumnWidth(0) =
Pego1.TAColumnWidth(1) =
Pego1.TAColumnWidth(2) =
Pego1.TAColumnWidth(3) =
Pego1.TAColumnWidth(4) =
Pego1.TAColumnWidth(5) =
Pego1.TAColumnWidth(6) =
Pego1.TAColumnWidth(7) =

7
7
7
7
7
7
7
7

'// Pass the table text //


For r = 0 To 3
For c = 0 To 7
Pego1.TAText(r, c) = Format$((Sin(0.3 * c + 1) *
500#) + (Rnd() * 50), "###0.00")

0)

If c > 5 Then
Pego1.TAColor(r, c) = Pego1.PEargb(255, 0, 148,

ElseIf c > 3 Then


Pego1.TAColor(r, c) = Pego1.PEargb(255, 148, 148,
0)
148)

ElseIf c > 1 Then


Pego1.TAColor(r, c) = Pego1.PEargb(255, 0, 148,
Else

Pego1.TAColor(r, c) = Pego1.PEargb(255, 198, 0,

0)

End If
Pego1.TAJustification(r, c) = PETAJ_CENTER
Next c
Next r
'// Other Table Related Properties ///
Pego1.ShowTableAnnotation = True

Pego1.TALocation = PETAL_INSIDE_AXIS_0
Pego1.TAAxisLocation = PETAAL_TOP_LEFT + PETAAL_NEW_ROW +
PETAAL_NEW_ROW
Pego1.TABorder = PETAB_SINGLE_LINE
Pego1.TABackColor = Pego1.PEargb(255, 200, 200, 200)
'// Done setting Table Annotations ///
'// Set Various Other Properties ///
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_LIGHT_INSET
Pego1.GridLineControl = PEGLC_BOTH
Pego1.DataPrecision = 0
Pego1.AxisNumberSpacing = 1.5
Pego1.PlottingMethod = GPM_BAR
Pego1.BarGlassEffect = False
Pego1.DataShadows = PEDS_3D
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 28 Then
'****************************************************************
*****'
'****************************************************************
*****'
'028 Graph showing Table Annotations, Real-time update
'//! Move mouse over chart to see tables update with the
subset values located
'//! at the vertical cursor line. //
'// This example builds upon the basic CreateSimpleGraph '000'

example chart //
Call CreateSimpleGraph
'// Construct a simple table annotation //
Pego1.WorkingTable = 0
Pego1.TARows = 1
Pego1.TAColumns = 6
'// column index for table with 6 columns //
'// 0 = symbol, no default width
'// 1 = text, subset label, no default width
'// 2 = text, data value, default width set to 7 characters
'// 3 = symbol second subset, no default width
'// 4 = text, second subset label, no default width
'// 5 = text, second data value, default width set to 7
characters
'// Pass the table type, text, color //
Pego1.TAType(0, 0) = LAT_SQUARESOLID
Pego1.TAColor(0, 0) = Pego1.PEargb(255,
Pego1.TAText(0, 1) = "Texas "
Pego1.TAColor(0, 1) = Pego1.PEargb(255,
Pego1.TAColor(0, 2) = Pego1.PEargb(255,
Pego1.TAType(0, 3) = LAT_SQUARESOLID
Pego1.TAColor(0, 3) = Pego1.PEargb(255,
Pego1.TAText(0, 4) = "Florida "
Pego1.TAColor(0, 4) = Pego1.PEargb(255,
Pego1.TAColor(0, 5) = Pego1.PEargb(255,
Pego1.TAColumnWidth(0)
Pego1.TAColumnWidth(1)
Pego1.TAColumnWidth(2)
Pego1.TAColumnWidth(3)
Pego1.TAColumnWidth(4)
Pego1.TAColumnWidth(5)

=
=
=
=
=
=

198, 0, 0)
0, 0, 0)
0, 0, 0)
0, 198, 198)
0, 0, 0)
0, 0, 0)

2
8
7
2
8
7

'// Other Table Related Properties ///


Pego1.ShowTableAnnotation = True
Pego1.TALocation = PETAL_INSIDE_AXIS_0
Pego1.TAAxisLocation = PETAAL_TOP_LEFT
Pego1.TABackColor = Pego1.PEargb(255, 55, 155, 198)
Pego1.TABorder = PETAB_INSET
'// Construct another table annotation //
Pego1.WorkingTable = 1
Pego1.TARows = 1
Pego1.TAColumns = 6
'// Pass the table type, text, color //
Pego1.TAType(0, 0) = LAT_SQUARESOLID
Pego1.TAColor(0, 0) = Pego1.PEargb(255, 198, 198, 0)
Pego1.TAText(0, 1) = "New York "

Pego1.TAColor(0, 1) = Pego1.PEargb(255,
Pego1.TAColor(0, 2) = Pego1.PEargb(255,
Pego1.TAType(0, 3) = LAT_SQUARESOLID
Pego1.TAColor(0, 3) = Pego1.PEargb(255,
Pego1.TAText(0, 4) = "California "
Pego1.TAColor(0, 4) = Pego1.PEargb(255,
Pego1.TAColor(0, 5) = Pego1.PEargb(255,
Pego1.TAColumnWidth(0)
Pego1.TAColumnWidth(1)
Pego1.TAColumnWidth(2)
Pego1.TAColumnWidth(3)
Pego1.TAColumnWidth(4)
Pego1.TAColumnWidth(5)

=
=
=
=
=
=

0, 0, 0)
0, 0, 0)
0, 198, 0)
0, 0, 0)
0, 0, 0)

2
8
7
2
8
7

'// Other Table Related Properties //


Pego1.ShowTableAnnotation = True
Pego1.TALocation = PETAL_INSIDE_AXIS_1
Pego1.TAAxisLocation = PETAAL_TOP_LEFT
Pego1.TABackColor = Pego1.PEargb(255, 55, 155, 198)
Pego1.TABorder = PETAB_INSET
Pego1.WorkingTable = 0
'// Other various Properties //
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_LIGHT_SHADOW
Pego1.MultiAxesSubsets(0) = 2
Pego1.MultiAxesSubsets(1) = 2
Pego1.MultiAxisStyle = PEMAS_SEPARATE_AXES
Pego1.PlottingMethod = GPM_POINTSPLUSLINE
Pego1.WorkingAxis = 1
Pego1.PlottingMethod = GPM_POINTSPLUSLINE
Pego1.WorkingAxis = 0
Pego1.ShowLegend = False
Pego1.MarkDataPoints = True
Pego1.AllowZooming = PEAZ_HORIZONTAL
Pego1.MultiAxesSizing = True
'// Make the line types bold //
Pego1.SubsetLineTypes(0) = PELT_MEDIUM_SOLID
Pego1.SubsetLineTypes(1) = PELT_MEDIUM_SOLID
Pego1.SubsetLineTypes(2) = PELT_MEDIUM_SOLID
Pego1.SubsetLineTypes(3) = PELT_MEDIUM_SOLID
Pego1.SubsetPointTypes(0)
Pego1.SubsetPointTypes(1)
Pego1.SubsetPointTypes(2)
Pego1.SubsetPointTypes(3)

=
=
=
=

PEPT_SQUARESOLID
PEPT_SQUARESOLID
PEPT_SQUARESOLID
PEPT_SQUARESOLID

Pego1.CursorMode = PECM_FLOATINGXY
Pego1.MouseCursorControl = True
Pego1.PEactions = REINITIALIZE_RESETIMAGE
'////////////////////////////////////////////////////////////////
////////////////
'// From the MouseMove Event
//
'// When mouse is moved, update table annotation contents.
//
'////////////////////////////////////////////////////////////////
////////////////
'
'// get last mouse location within control //
'
Dim pX As Integer
'
Dim pY As Integer
'
Pego1.GetLastMouseMove pX, pY
'
'
nA = 0
'// Initialize axis, non-zero only if using
MultiAxesSubsets
'
nX = pX
'// Initialize nX and nY with mouse location
'
nY = pY
'
Pego1.PEconvpixeltograph nA, nX, nY, fX, fY, 0, 0, 0
'
'
'// We now know data coordinates for mouse location //
'
'
'// Use fX to interpolate each subset to find approximate Y
value //
'
Dim Subset1Y As Single
'
Dim Subset2Y As Single
'
Dim Subset3Y As Single
'
Dim Subset4Y As Single
'
Dim slope As Single
'
Dim y0 As Single
'
Dim y1 As Single
'
Dim y2 As Single
'
Dim x1 As Single
'
Dim x2 As Single
'
'
nX = Int(fX) - 1
'// nX is floor of fX
'
x2 = nX + 1
'// x2 is right most point index
'
x1 = nX
'// x1 is left most point index or nX
'
'
If (fX < 1 Or fX > 12) Then
'
Pego1.WorkingTable = 0
'
Pego1.TAText(0, 2) = "
"
'
Pego1.TAText(0, 5) = "
"
'
Pego1.WorkingTable = 1

'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'

Pego1.TAText(0, 2) = "
Pego1.TAText(0, 5) = "
Pego1.PEdrawtable 0
Pego1.PEdrawtable 1
Exit Sub
End If

"
"

fX = fX - 1#
'// 1st subset //
y2 = Pego1.YData(0, nX + 1)
y1 = Pego1.YData(0, nX)
slope = (y2 - y1) / (x2 - x1)
y0 = y1 - (slope * x1)
Subset1Y = (slope * fX) + y0
'// 2nd subset //
y2 = Pego1.YData(1, nX + 1)
y1 = Pego1.YData(1, nX)
slope = (y2 - y1) / (x2 - x1)
y0 = y1 - (slope * x1)
Subset2Y = (slope * fX) + y0
'// 3rd subset //
y2 = Pego1.YData(2, nX + 1)
y1 = Pego1.YData(2, nX)
slope = (y2 - y1) / (x2 - x1)
y0 = y1 - (slope * x1)
Subset3Y = (slope * fX) + y0
'// 4th subset //
y2 = Pego1.YData(3, nX + 1)
y1 = Pego1.YData(3, nX)
slope = (y2 - y1) / (x2 - x1)
y0 = y1 - (slope * x1)
Subset4Y = (slope * fX) + y0
'// Place text in table annotation //
Pego1.WorkingTable = 0
Pego1.TAText(0, 2) = Format$(Subset1Y, "##0.00")
Pego1.TAText(0, 5) = Format$(Subset2Y, "##0.00")
Pego1.WorkingTable = 1
Pego1.TAText(0, 2) = Format$(Subset3Y, "##0.00")
Pego1.TAText(0, 5) = Format$(Subset4Y, "##0.00")
Pego1.PEdrawtable 0
Pego1.PEdrawtable 1

ElseIf nChart = 29 Then


'****************************************************************
*****'

'****************************************************************
*****'
'029 Graph showing Table Annotations, Table spaced
'//! This shows how to place extra text inside table and
within an axis. //
'//! Maximize to allow room for textual data which is drawn
as fixed font size. //
'// This example builds upon the basic CreateSimpleGraph
'000' example chart //
Call CreateSimpleGraph
'// Create two y axes //
Pego1.MultiAxesSubsets(0) = 2
Pego1.MultiAxesSubsets(1) = 2
'// Construct a simple table annotation //
Pego1.WorkingTable = 0
Pego1.TARows = 6
Pego1.TAColumns = 12
'//! 12 is same number as PEP_nPOINTS
'// Pass the table text //
Dim b As Boolean
Dim dwColor As Long
For r = 0 To 5
If (b) Then
dwColor = Pego1.PEargb(255, 175, 175, 175)
Else
dwColor = Pego1.PEargb(255, 255, 255, 255)
End If
b = Not b
For c = 0 To 11
Pego1.TAText(r, c) = Format$((Sin(0.3 * c + 1) *
500#) + (Rnd() * 50), "###0.000")
Pego1.TAColor(r, c) = dwColor
Next c
Next r
'// Set Table Location //
Pego1.TALocation = PETAL_INSIDE_AXIS_1
Pego1.TAAxisLocation = PETAAL_BOTTOM_TABLE_SPACED
'// Other Table Related Properties ///
Pego1.ShowTableAnnotation = True
Pego1.TABorder = PETAB_NO_BORDER
Pego1.TABackColor = 1 '// Same as GraphBackColor in this
instance
Pego1.TAForeColor = 1 '// Same as GraphForeColor in this
instance

'// Construct a second simple table annotation //


Pego1.WorkingTable = 1
Pego1.TARows = 6
Pego1.TAColumns = 12
'// Pass the table text //
b = True
For r = 0 To 5
If (b) Then
dwColor = Pego1.PEargb(255, 175, 175, 175)
Else
dwColor = Pego1.PEargb(255, 255, 255, 255)
End If
b = Not b
For c = 0 To 11
Pego1.TAText(r, c) = Format$((Sin(0.3 * c + 1) *
500#) + (Rnd() * 50), "###0.000")
Pego1.TAColor(r, c) = dwColor
Next c
Next r
'// Set Table Location //
Pego1.TALocation = PETAL_INSIDE_AXIS
Pego1.TAAxisLocation = PETAAL_BOTTOM_TABLE_SPACED
'// Other Table Related Properties ///
Pego1.ShowTableAnnotation = True
Pego1.TABorder = PETAB_NO_BORDER
Pego1.TABackColor = 1 '// Same as GraphBackColor in this
instance
Pego1.TAForeColor = 1 '// Same as GraphForeColor in this
instance
'// Construct a third simple table annotation //
Pego1.WorkingTable = 2
Pego1.TARows = 2
Pego1.TAColumns = 13 '// 12 + extra header column
'// Pass the table text //
For r = 0 To 1
For c = 1 To 12
Pego1.TAText(r, c) = Format$((Sin(0.3 * c + 1) *
500#) + (Rnd() * 50), "###0.000")
Next c
Next r
'// Set Table Location //
Pego1.TALocation = PETAL_INSIDE_TABLE
Pego1.TAAxisLocation = PETAAL_TOP_TABLE_SPACED

'// Other Table Related Properties ///


Pego1.ShowTableAnnotation = True
Pego1.TABackColor = Pego1.PEargb(255, 0, 198, 198)
Pego1.TAHeaderColumn = True
'// Set Text for Header Column //
Pego1.TAText(0, 0) = "Table Annotation Line 1"
Pego1.TAText(1, 0) = "Table Annotation Line 2"
'// Done setting Table Annotations ///
'// Set Various Other Properties ///
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_DARK_INSET
Pego1.DataPrecision = 0
Pego1.GraphPlusTable = PEGPT_BOTH
Pego1.LegendStyle = PELS_1_LINE_INSIDE_AXIS
Pego1.GridLineControl = PEGLC_YAXIS
Pego1.MarkDataPoints = False
Pego1.FontSize = PEFS_SMALL
Pego1.DataShadows = PEDS_SHADOWS
Pego1.ShowLegend = True
Pego1.WorkingAxis = 0
Pego1.PlottingMethod = GPM_BAR
Pego1.PlottingMethodII = GPMII_POINTSPLUSLINE
Pego1.RYAxisComparisonSubsets = 1
Pego1.RYAxisColor = Pego1.PEargb(255, 0, 198, 198)
Pego1.YAxisLabel = ""
Pego1.RYAxisLabel = ""
Pego1.WorkingAxis = 1
Pego1.PlottingMethod = PEGPM_BAR
Pego1.RYAxisComparisonSubsets = 1
Pego1.PlottingMethodII = GPMII_POINTSPLUSLINE
Pego1.RYAxisColor = Pego1.PEargb(255, 0, 198, 0)
Pego1.YAxisLabel = ""
Pego1.RYAxisLabel = ""
Pego1.SubsetColors(0)
Pego1.SubsetColors(1)
Pego1.SubsetColors(2)
Pego1.SubsetColors(3)

=
=
=
=

Pego1.PEargb(128,
Pego1.PEargb(128,
Pego1.PEargb(128,
Pego1.PEargb(128,

138, 0, 0)
0, 255, 255)
138, 138, 0)
0, 255, 0)

Pego1.ShowTableAnnotationsMenu = PEMC_SHOW
Pego1.DataPrecisionMenu = PEMC_HIDE
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 30 Then
'****************************************************************

*****'
'****************************************************************
*****'
'030 Graph showing Table Annotations, Hot Spots
'//! Please read the RED text within this code window and
others.
'//! You will find important information that improves your
experience with the demo.
'//!
'//! Some things to try...
'//! 1) Right click the chart and use the popup menu to
adjust viewing style and other items.
'//! 2) Left click and drag to zoom, use popup menu to undo
zoom. Note how time scale changes.
'//! 3) Left click the Portfolio table to select different
stocks.
'//! 4) Change Point Label Orientation via the popup menu and
note how x axis scale changes.
'//! 5) The Data Cursor can be moved with arrow keys. Click
a data point and then use arrow keys.
'//! 6) Zoom chart and watch the Volume bar plotting method
structure for different time ranges.
'//!
There's new drawing logic that first recongnizes all
bars are connected, then as range is shrunk,
'//!
bar's get drawn 1 pixel apart, and finally after
zooming more, bars are spaced.
'// Note, the entire code to produce this example is shown
below.
'// The immediate secion controls chart construction, latter
sections show.
'// how to respond to mouse-move and table annotation hot
spot events.
'// The final section shows how the data is loaded from a
comma delimited.
'// file and studies calculated.
'// This example shows a collection of features.
'// Table Annotation Hot Spots can turn table annotations
into user interface objects.
'// Also shown is real-time table annotation updating and
date/time handling.
'// Enable ZoomWindow //
Pego1.ZoomWindow = True
'// Enable MouseWheel Zooming
Pego1.MouseWheelFunction = 4
Pego1.MouseDraggingX = True '// note that pan gestures
require MouseDragging to be enabled

'// Enable MouseWheel Zoom Smoothness


Pego1.MouseWheelZoomSmoothness = 3
Pego1.PinchZoomSmoothness = 2
'// Enable Bar Glass Effect //
Pego1.BarGlassEffect = True
'// Enable Plotting style gradient and bevel features //
Pego1.AreaGradientStyle = PEPGS_RADIAL_BOTTOM_RIGHT
Pego1.AreaBevelStyle = PEBS_MEDIUM_SMOOTH
Pego1.SplineGradientStyle = PEPGS_RADIAL_BOTTOM_RIGHT
Pego1.SplineBevelStyle = PESBS_MEDIUM_SMOOTH
'// No Flicker //
Pego1.PrepareImages = True
Pego1.CacheBmp = True
'// Fixed Font Sizes //
Pego1.FixedFonts = True
'// YAxis Changes Range as you pan horizontally or zoom //
Pego1.ScrollingScaleControl = True
'// Construct a simple table annotation //
Pego1.WorkingTable = 0
Pego1.TARows = 18
Pego1.TAColumns = 1
'// Pass the table text //
Pego1.TAText(0, 0) = "Portfolio"
Pego1.TAText(1, 0) = " MSFT"
Pego1.TAText(2, 0) = " SUNW"
Pego1.TAText(3, 0) = " ORCL"
Pego1.TAText(4, 0) = " IBM"
Pego1.TAText(5, 0) = " INTC"
Pego1.TAText(6, 0) = " NSM"
Pego1.TAText(7, 0) = " DELL"
Pego1.TAText(8, 0) = " WMT"
Pego1.TAText(9, 0) = " CVX"
Pego1.TAText(10, 0) = " PBG"
Pego1.TAText(11, 0) = "-----------------"
Pego1.TAHotSpot(1, 0) = True
Pego1.TAHotSpot(2, 0) = True
Pego1.TAHotSpot(3, 0) = True
Pego1.TAHotSpot(4, 0) = True
Pego1.TAHotSpot(5, 0) = True
Pego1.TAHotSpot(6, 0) = True
Pego1.TAHotSpot(7, 0) = True
Pego1.TAHotSpot(8, 0) = True
Pego1.TAHotSpot(9, 0) = True
Pego1.TAHotSpot(10, 0) = True

Pego1.TAColor(0, 0) = 1
Pego1.TAColor(1, 0) = Pego1.PEargb(255, 198, 0, 0)
Pego1.TAColor(2, 0) = Pego1.PEargb(255, 142, 142, 142)
Pego1.TAColor(3, 0) = Pego1.PEargb(255, 142, 142, 142)
Pego1.TAColor(4, 0) = Pego1.PEargb(255, 142, 142, 142)
Pego1.TAColor(5, 0) = Pego1.PEargb(255, 142, 142, 142)
Pego1.TAColor(6, 0) = Pego1.PEargb(255, 142, 142, 142)
Pego1.TAColor(7, 0) = Pego1.PEargb(255, 142, 142, 142)
Pego1.TAColor(8, 0) = Pego1.PEargb(255, 142, 142, 142)
Pego1.TAColor(9, 0) = Pego1.PEargb(255, 142, 142, 142)
Pego1.TAColor(10, 0) = Pego1.PEargb(255, 142, 142, 142)
Pego1.TAColor(11, 0) = Pego1.PEargb(255, 0, 0, 0)
Pego1.TAColor(12, 0) = Pego1.PEargb(255, 0, 0, 0)
Pego1.TAColor(13, 0) = Pego1.PEargb(255, 142, 142, 142)
Pego1.TAColor(14, 0) = Pego1.PEargb(255, 142, 142, 142)
Pego1.TAColor(15, 0) = Pego1.PEargb(255, 0, 170, 0)
Pego1.TAColor(16, 0) = Pego1.PEargb(255, 198, 0, 0)
Pego1.TAColor(17, 0) = Pego1.PEargb(255, 0, 0, 170)
Pego1.TAColumnWidth(0) = 8
'// Set Table Location //
Pego1.TALocation = PETAL_LEFT_CENTER
'// Other Table Related Properties ///
Pego1.ShowTableAnnotation = True
Pego1.TABorder = PETAB_INSET
Pego1.TABackColor = Pego1.PEargb(255, 255, 255, 255)
Pego1.TAForeColor = Pego1.PEargb(255, 0, 0, 0)
Pego1.TAHeaderRows = 1
Pego1.TATextSize = 100
'// Done setting Table Annotations //
'// Load Data and Add Studies, Total of 11 subsets when
finished //
Call LoadData("MSFT")
'//! Set properties related to date/time mode //
Pego1.DeltasPerDay = 1
'// 1 data point per day
Pego1.DeltaX = -1
'// -1 special code for daily
data //
Pego1.DateTimeMode = PEDTM_VB '// How to interpret serial
dates //
Pego1.YearMonthDayPrompt = PEDP_INSIDE_TOP
Pego1.DayLabelType = PEDLT_1_CHAR
Pego1.MonthLabelType = PEDLT_3_CHAR
'// Split up subsets among different axes //
Pego1.MultiAxesSubsets(0) = 7 '// ohlc and upper bollinger,
sma, lower bollinger

Pego1.MultiAxesSubsets(1) = 1
Pego1.MultiAxesSubsets(2) = 1
Pego1.MultiAxesSubsets(3) = 2
Pego1.MultiAxesProportions(0)
Pego1.MultiAxesProportions(1)
Pego1.MultiAxesProportions(2)
Pego1.MultiAxesProportions(3)

'// volume
'// RSI
'// Fast and Slow Stochastic
=
=
=
=

0.55
0.15
0.15
0.15

'// Set Various Other Properties ///


Pego1.DataPrecision = 2
Pego1.MultiAxisStyle = PEMAS_SEPARATE_AXES
Pego1.MultiAxesSizing = True
Pego1.YAxisOnRight = True
Pego1.SpecificPlotModeColor = True '// Enables mult-colored
candle stick fills
Pego1.DataShadows = PEDS_NONE
Pego1.AllowZooming = PEAZ_HORZANDVERT
Pego1.ZoomStyle = PEZS_RO2_NOT
Pego1.MouseCursorControl = True
Pego1.AllowDataHotSpots = True
Pego1.CursorPromptTracking = False
Pego1.CursorPromptStyle = PECPS_NONE
Pego1.HotSpotSize = PEHSS_LARGE
Pego1.ShowXAxis = PESA_GRIDNUMBERS
Pego1.MainTitle = ""
Pego1.SubTitle = ""
Pego1.PointSize = PEPS_MEDIUM
Pego1.AllowMaximization = False
Pego1.GridLineControl = PEGLC_BOTH
Pego1.SimpleLineLegend = True
Pego1.SimplePointLegend = True
Pego1.LegendStyle = PELS_1_LINE_TOP_OF_AXIS
Pego1.AutoMinMaxPadding = 1
Pego1.OHLCMinWidth = 12 '// Controls minium candle-stick
width //
Pego1.GraphPlusTableMenu = PEMC_HIDE
Pego1.TableWhatMenu = PEMC_HIDE
Pego1.MultiAxisStyleMenu = PEMC_SHOW
Pego1.LegendLocationMenu = PEMC_SHOW
Pego1.ShowTableAnnotationsMenu = PEMC_SHOW
Pego1.AllowAnnotationControl = True
Pego1.PrintStyleControl = PEPSC_DEFAULT_MONO
'// Set up per axis properties //
Pego1.WorkingAxis = 0
Pego1.PlottingMethod = GPM_SPECIFICPLOTMODE
Pego1.SpecificPlotMode = PESPM_BOXPLOT
Pego1.ComparisonSubsets = 3
Pego1.ShowYAxis = PESA_GRIDNUMBERS

Pego1.WorkingAxis = 1
Pego1.PlottingMethod = GPM_BAR
Pego1.ShowYAxis = PESA_GRIDNUMBERS
Pego1.WorkingAxis = 2
Pego1.PlottingMethod = GPM_LINE
Pego1.ShowYAxis = PESA_GRIDNUMBERS
Pego1.WorkingAxis = 3
Pego1.PlottingMethod = GPM_AREA
Pego1.ShowYAxis = PESA_GRIDNUMBERS
'// Set Subset Colors //
Pego1.SubsetColors(0) = Pego1.PEargb(255, 0, 0, 148)
Pego1.SubsetColors(1) = Pego1.PEargb(255, 0, 0, 148)
Pego1.SubsetColors(2) = Pego1.PEargb(255, 198, 0, 0)
Pego1.SubsetColors(3) = Pego1.PEargb(255, 0, 198, 0)
Pego1.SubsetColors(4) = Pego1.PEargb(80, 198, 0, 0)
Pego1.SubsetColors(5) = Pego1.PEargb(80, 225, 225, 0)
Pego1.SubsetColors(6) = Pego1.PEargb(80, 0, 0, 190)
Pego1.SubsetColors(7) = Pego1.PEargb(255, 0, 0, 190)
Pego1.SubsetColors(8) = Pego1.PEargb(255, 198, 0, 0)
Pego1.SubsetColors(9) = Pego1.PEargb(180, 198, 0, 0)
Pego1.SubsetColors(10) = Pego1.PEargb(60, 0, 255, 255)
'// Set Subset Line Types //
Pego1.SubsetLineTypes(0) = PELT_THIN_SOLID
Pego1.SubsetLineTypes(1) = PELT_THIN_SOLID
Pego1.SubsetLineTypes(2) = PELT_MEDIUM_THIN_SOLID
Pego1.SubsetLineTypes(3) = PELT_MEDIUM_THIN_SOLID
Pego1.SubsetLineTypes(4) = PELT_MEDIUM_THIN_SOLID
Pego1.SubsetLineTypes(5) = PELT_MEDIUM_THIN_SOLID
Pego1.SubsetLineTypes(6) = PELT_MEDIUM_THIN_SOLID
Pego1.SubsetLineTypes(7) = PELT_MEDIUM_THIN_SOLID
Pego1.SubsetLineTypes(8) = PELT_MEDIUM_THIN_SOLID
Pego1.SubsetLineTypes(9) = PELT_MEDIUM_THIN_SOLID
Pego1.SubsetLineTypes(10) = PELT_MEDIUM_THIN_SOLID
'// Set Subset Labels //
Pego1.SubsetLabels(0) = "High"
Pego1.SubsetLabels(1) = "Low"
Pego1.SubsetLabels(2) = "Open"
Pego1.SubsetLabels(3) = "Close"
Pego1.SubsetLabels(4) = "Bollinger Upper"
Pego1.SubsetLabels(5) = "SMA 20"
Pego1.SubsetLabels(6) = "Bollinger Lower"
Pego1.SubsetLabels(7) = "Volume"
Pego1.SubsetLabels(8) = "Relative Strength Index - 10"
Pego1.SubsetLabels(9) = "Fast %K"
Pego1.SubsetLabels(10) = "Slow %D"

Pego1.GradientBars = 14
Pego1.TextShadows = PETS_BOLD_TEXT
Pego1.MainTitleBold = True
Pego1.SubTitleBold = True
Pego1.LabelBold = True
Pego1.LineShadows = True
Pego1.FontSize = PEFS_MEDIUM
Pego1.DataShadows = PEDS_SHADOWS
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_LIGHT_NO_BORDER
'// v7.2 new features //
Pego1.PointGradientStyle = PEPGS_VERTICAL_ASCENT_INVERSE
Pego1.PointBorderColor = Pego1.PEargb(100, 0, 0, 0)
Pego1.LineSymbolThickness = 3
Pego1.AreaBorder = 1
Pego1.SolidLineOverArea = 1
Pego1.ImageAdjustTop = 75
Pego1.ImageAdjustLeft = 75
Pego1.ImageAdjustRight = 75
'// Sets various export defaults //
Pego1.DpiX = 600
Pego1.DpiY = 600
Pego1.ExportSizeDef = PEESD_NO_SIZE_OR_PIXEL
Pego1.ExportTypeDef = PEETD_PNG
Pego1.ExportDestDef = PEEDD_CLIPBOARD
Pego1.ExportUnitXDef = "1280"
Pego1.ExportUnitYDef = "768"
Pego1.ExportImageDpi = 300
Pego1.AllowSvgExport = True
Pego1.RenderEngine = PERE_DIRECT2D
Pego1.AntiAliasGraphics = True
Pego1.AntiAliasText = True
Pego1.PEactions = REINITIALIZE_RESETIMAGE
'////////////////////////////////////
'// DataHotSpot Event Handler
//
'////////////////////////////////////
'
Private Sub Pego1_DataHotSpot(DblClk As Integer, subsetindex
As Long, pointindex As Long)
'
'// Example 030 is only example with data hot spots //
'
Pego1.CursorMode = PECM_POINT
'// Enable Vertical
Cursor Mode.
'
Pego1.CursorPoint = pointindex '// Set Cursor's focus
selected point.
'
End Sub

'//////////////////////////////////
'// MouseMove Event Handler
//
'//////////////////////////////////
'
Private Sub Pego1_MouseMove(Button As Integer, Shift As
Integer, X As Single, Y As Single)
'
Dim fI As Double
'
Dim fHigh As Single
'
Dim fLow As Single
'
Dim fOpen As Single
'
Dim fClose As Single
'
Dim fVolume As Single
'
Dim szDate As String
'
Dim szFmt As String
'
'
'// get last mouse location within control //
'
Pego1.GetLastMouseMove pX, pY
'
'
nA = 0
'// Initialize axis, non-zero only if using
MultiAxesSubsets
'
nX = pX
'// Initialize nX and nY with mouse
location
'
nY = pY
'
Pego1.PEconvpixeltograph nA, nX, nY, fX, fY, 0, 0, 0
'
'
'// We now know data coordinates for mouse location //
'
'
'// Code to pick closest point index //
'
fY = Abs(fX - Int(fX))
'
If (fY > 0.5) Then
'
nX = Int(fX)
'
Else
'
nX = Int(fX) - 1
'
End If
'
'
If (fX < 1 Or fX > 731) Then '// 731 points per subset
in data file
'
Pego1.TAText(12, 0) = "
"
'
Pego1.TAText(13, 0) = "
"
'
Pego1.TAText(14, 0) = "
"
'
Pego1.TAText(15, 0) = "
"
'
Pego1.TAText(16, 0) = "
"
'
Pego1.TAText(17, 0) = "
"
'
Pego1.PEdrawtable 0
'
Exit Sub
'
End If
'
'
nX = nX - 1#
'
'
'// Get Data at closest point //
'
fHigh = Pego1.YData(0, nX)
'
fLow = Pego1.YData(1, nX)

'
fOpen = Pego1.YData(2, nX)
'
fClose = Pego1.YData(3, nX)
'
fVolume = Pego1.YData(7, nX)
'
szDate = Pego1.PointLabels(nX)
'
'
'// Place text in table annotation //
'
'// Get numeric precision //
'
nX = Pego1.DataPrecision
'
szFmt = "###."
'
For t = 0 To nX - 1
'
szFmt = szFmt + "0"
'
Next t
'
'
'// Place text in table annotation //
'
Pego1.WorkingTable = 0
'
Pego1.TAText(12, 0) = szDate
'
'
Pego1.TAText(13, 0) = "H:" + Format$(fHigh, szFmt)
'
Pego1.TAText(14, 0) = "L:" + Format$(fLow, szFmt)
'
Pego1.TAText(15, 0) = "O:" + Format$(fOpen, szFmt)
'
Pego1.TAText(16, 0) = "C:" + Format$(fClose, szFmt)
'
Pego1.TAText(17, 0) = "V:" + Format$(fVolume,
"#############")
'
'
Pego1.PEdrawtable 0
'
End Sub
'/////////////////////////////////////////////
'// Table Annotation Hot Spot Event Handler //
'/////////////////////////////////////////////
'
Private Sub Pego1_TableAnnotation(DblClk As Integer, nIndex
As Integer, nRow As Long, nColumn As Long)
'
Dim i As Long
'
If (nIndex = 0) Then ' // zero represents first table
annotation
'
Pego1.ZoomMode = False
'
Pego1.PointsToGraph = 0 '// plot all points
'
'
'// Change color of selected table item //
'
For i = 1 To 10
'
Pego1.TAColor(i, 0) = RGB(142, 142, 142)
'
Next
'
Pego1.TAColor(nRow, nColumn) = RGB(198, 0, 0)
'
'
Dim szSym As String
'
szSym = LTrim$(Pego1.TAText(nRow, nColumn))
'
'
'// OK, Change Data //
'
LoadData (szSym)
'
'
Pego1.PEreinitialize
'
Pego1.PEresetimage 0, 0

'
'
'

Call InvalidateRect(Pego1.hWnd, 0, 0)
End If
End Sub
'////////////////////////////////////
'// CursorMoved Event Handler
//
'////////////////////////////////////
Private Sub Pego1_CursorMoved()
Dim t As Long
Dim nX As Long
Dim fHigh As Single
Dim fLow As Single
Dim fOpen As Single
Dim fClose As Single
Dim fVolume As Single
Dim szDate As String
Dim szFmt As String

'
'
'
'
'
'
'
'
'
'
'
'
nX = Pego1.CursorPoint
'
'
'// Get Data at closest point //
'
fHigh = Pego1.YData(0, nX)
'
fLow = Pego1.YData(1, nX)
'
fOpen = Pego1.YData(2, nX)
'
fClose = Pego1.YData(3, nX)
'
fVolume = Pego1.YData(7, nX)
'
szDate = Pego1.PointLabels(nX)
'
'
'// Get numeric precision //
'
nX = Pego1.DataPrecision
'
'
szFmt = "###."
'
For t = 0 To nX - 1
'
szFmt = szFmt + "0"
'
Next t
'
'
'// Place text in table annotation //
'
Pego1.WorkingTable = 0
'
Pego1.TAText(12, 0) = szDate
'
'
Pego1.TAText(13, 0) = "H:" + Format$(fHigh, szFmt)
'
Pego1.TAText(14, 0) = "L:" + Format$(fLow, szFmt)
'
Pego1.TAText(15, 0) = "O:" + Format$(fOpen, szFmt)
'
Pego1.TAText(16, 0) = "C:" + Format$(fClose, szFmt)
'
Pego1.TAText(17, 0) = "V:" + Format$(fVolume,
"#############")
'
'
Pego1.PEdrawtable 0
'
'
End Sub
'///////////////////////

'// LoadData Function //


'///////////////////////
'
Public Sub LoadData(newName As String)
'
'// Function to load financial data from a comma
delimited file //
'
Dim szFile As String
'
szFile = newName + ".txt"
'
'
ReDim y1(1000) As Single
'
ReDim y2(1000) As Single
'
ReDim y3(1000) As Single
'
ReDim y4(1000) As Single
'
ReDim y5(1000) As Single
'
ReDim X0(1000) As Double
'
ReDim Xs(1000) As String
'
Dim c As Long
'
Dim i As Long
'
Dim s As String
'
Dim d As Date
'
Dim day As Long
'
Dim month As Long
'
Dim year As Long
'
Dim sDate As String
'
Dim sOpen As String
'
Dim sHigh As String
'
Dim sLow As String
'
Dim sClose As String
'
Dim sVolume As String
'
Dim dstart As Double
'
Dim nCnt As Long
'
'
'// Open Data File //
'
Open szFile For Input As #1
'
Do While Not EOF(1)
' Loop until end of file.
'
Input #1, sDate, sOpen, sHigh, sLow, sClose, sVolume
'
'
'// Get date and transfer into a number
'
year = Val(Mid$(sDate, 1, 2))
'
If year > 90 Then
'
year = year + 1900
'
ElseIf year < 10 Then
'
year = year + 2000
'
End If
'
'
month = Val(Mid$(sDate, 3, 2))
'
day = Val(Mid$(sDate, 5, 2))
'
Xs(c) = LTrim$(Str$(month)) + "/" + LTrim$(Str$
(day)) + "/" + LTrim$(Str$(year))
'
d = CDate(LTrim$(Str$(month)) + "/" + LTrim$(Str$
(day)) + "/" + LTrim$(Str$(year)))
'
X0(c) = CDbl(d) + 0.5 '// .5 means Give daily data a
time of noon

'
'
'// store Open, High, Low, Close, and Volume //
'
y1(c) = CSng(sOpen)
'
y2(c) = CSng(sHigh)
'
y3(c) = CSng(sLow)
'
y4(c) = CSng(sClose)
'
y5(c) = CSng(sVolume)
'
'
c = c + 1
'
Loop
'
Close #1
'
'
'// Pass data into chart //
'
nCnt = c - 1
'
Pego1.StartTime = X0(0) 'dstart
'
'
Pego1.Subsets = 11
'
Pego1.Points = nCnt
'
Pego1.UsingXDataII = True
'
'
'//! Empty data so we can make sure we are completely
resetting //
'
Pego1.YData(0, -1) = 0
'
Pego1.XDataII(0, -1) = 0
'
Pego1.PointLabels(-1) = "0" '//! note 0 in quotes
'
'//! -1 above is a special index that tells
ProEssentials you are resizing property
'
For i = 0 To (nCnt - 1)
'
Pego1.YData(0, i) = y2(i) '// high
'
Pego1.YData(1, i) = y3(i) '// low
'
Pego1.YData(2, i) = y1(i) '// open
'
Pego1.YData(3, i) = y4(i) '// close
'
Pego1.YData(7, i) = y5(i) '// volume
'
Pego1.XDataII(0, i) = X0(i)
'
Pego1.PointLabels(i) = Xs(i)
'
Next i
'
'
'// We now have data, let's make some studies //
'
'
'////////////////////////////////////////////////////////////////
////
'
'// Bollinger Bands //
'
'/////////////////////
'
'
Dim ID As Long
'
Dim f As Single
'
Dim Days As Double
'
Dim pnt As Long
'
Dim Total As Double
'
Dim Total2 As Double
'
Dim X As Long

'
Dim SMAfBB As Double
'
Dim BBNum As Double
'
'
X = 1
'
'
ReDim pYD3(nCnt) As Single
'
'
For pnt = 0 To (nCnt - 1)
'
pYD3(pnt) = Pego1.YData(3, pnt)
'
Next
'
'
'// Middle Band = SMA
'
Days = 20
'
For pnt = 0 To (nCnt - Days - 1)
'
Total = 0
'
For i = 0 + pnt To Days + pnt - 1
'
Total = Total + pYD3(i)
'
Next
'
f = Total / Days
'
Pego1.YData(5, pnt + Days - 1) = f
'
Next
'
'
'// Upper Band = Middle Band + [Standard Deviation *
Square Root{[Sum for x Days((Closing Price - Middle
Band)^2)]/Days]
'
For pnt = 0 To (nCnt - Days - 1)
'
Total = 0
'
For i = 0 + pnt To Days + pnt - 1
'
Total = Total + pYD3(i)
'
Next
'
SMAfBB = Total / Days
'
'// Find sum of Closing Price minus SMA over days
and square
'
BBNum = 0
'
For i = 0 + pnt To Days + pnt - 1
'
BBNum = ((pYD3(i) - SMAfBB) * (pYD3(i) SMAfBB)) + BBNum
'
Next
'
f = SMAfBB + 2# * Sqr(BBNum / Days)
'
Pego1.YData(4, pnt + Days - 1) = f
'
Next
'
'
'// Lower Band = Middle Band - [Standard Deviation *
Square Root{[Sum for x Days((Closing Price - Middle
Band)^2)]/Days]
'
For pnt = 0 To (nCnt - Days - 1)
'
Total = 0
'
For i = 0 + pnt To Days + pnt - 1
'
Total = Total + pYD3(i)
'
Next
'
SMAfBB = Total / Days
'
'// Find sum of Closing Price minus SMA over days

and square
'
BBNum = 0
'
For i = 0 + pnt To Days + pnt - 1
'
BBNum = ((pYD3(i) - SMAfBB) * (pYD3(i) SMAfBB)) + BBNum
'
Next
'
f = SMAfBB - 2# * Sqr(BBNum / Days)
'
Pego1.YData(6, pnt + Days - 1) = f
'
Next
'
'
'////////////////////////////////////////////////////////////////
////////////////////
'
'// Relative Strength Index //
'
'/////////////////////////////
'
'
Total = 0
'
Total2 = 0
'
Dim RS As Single
'
Dim RSI As Single
'
X = 1
'
Dim LowerCount As Long
'
Dim UpperCount As Long
'
'
'// How many days do you want to check
'
Days = 10
'
'
ReDim pUpperArray(nCnt) As Single
'
ReDim pLowerArray(nCnt) As Single
'
'
'// Find the amount the price closed UP from the
previous day
'
'// also find the amount the price closed down from the
previous day.
'
'// Over the designated time period.
'
'
For i = 1 To Days
'
If ((pYD3(i) - pYD3(i - 1)) < 0) Then
'
pLowerArray(LowerCount) = (pYD3(i) - pYD3(i 1))
'
LowerCount = LowerCount + 1
'
Else
'
pUpperArray(UpperCount) = (pYD3(i) - pYD3(i 1))
'
UpperCount = UpperCount + 1
'
End If
'
Next
'
'
'// Total the amounts over the period
'
Total = 0
'
For i = 0 To LowerCount - 1
'
Total = pLowerArray(i) + Total

'
Next
'
Total2 = 0
'
For i = 0 To UpperCount - 1
'
Total2 = pUpperArray(i) + Total2
'
Next
'
'// Divide up by down
'
RS = (Total2 / Days) / (Abs(Total) / Days)
'
'
'// Use the RSI formula
'
RSI = 100# - (100# / (1# + RS))
'
Pego1.YData(8, Days - 1) = RSI
'
'
For i = Days To nCnt - 1
'
If (pYD3(i) <> 0 And pYD3(i - 1) <> 0) Then
'
Total = Total * (Days - 1)
'
Total2 = Total2 * (Days - 1)
'
'
If ((pYD3(i) - pYD3(i - 1)) < 0) Then
'
Total = (pYD3(i) - pYD3(i - 1)) + Total
'
Else
'
Total2 = (pYD3(i) - pYD3(i - 1)) + Total2
'
End If
'
'
Total = Total / Days
'
Total2 = Total2 / Days
'
'
RS = (Total2) / (Abs(Total))
'
RSI = 100# - (100# / (1# + RS))
'
Pego1.YData(8, Days - 1 + i) = RSI
'
End If
'
Next
'
'
'// Add a mid axis line annotation
'
Pego1.HorzLineAnnotation(0) = 50#
'
Pego1.HorzLineAnnotationAxis(0) = 2
'
Pego1.HorzLineAnnotationType(0) =
PELAT_MEDIUM_THIN_SOLID
'
Pego1.HorzLineAnnotationColor(0) = RGB(198, 0, 0)
'
Pego1.ShowAnnotations = True
'
'
'// Set the working axis extents
'
Pego1.WorkingAxis = 2
'
Pego1.ManualScaleControlY = PEMSC_MINMAX
'
Pego1.ManualMinY = 0
'
Pego1.ManualMaxY = 100
'
'
'////////////////////////////////////////////////////////////////
/////
'
'// Stochastic Oscillator //
'
'///////////////////////////
'

'
Dim SwFac As Long
'
Dim Dperiod As Long
'
Dim q As Long
'
Dim LowMin As Single
'
Dim HighMax As Single
'
Dim SlowK As Single
'
Dim Dfactor As Single
'
Dim PercentD As Single
'
'
LowMin = 9999.9
'
HighMax = 0#
'
'
ReDim pSlowOC(nCnt + 1) As Single
'
ReDim pKperiod(nCnt + 1) As Single
'
ReDim pHigh(nCnt + 1) As Single
'
ReDim pLow(nCnt + 1) As Single
'
'
For pnt = 0 To nCnt - 1
'
pHigh(pnt) = Pego1.YData(0, pnt)
'
pLow(pnt) = Pego1.YData(1, pnt)
'
Next
'
'
'// How many days do you want to check
'
Days = 30
'
SwFac = 1
'
Dperiod = 15
'
'
For pnt = 0 To (nCnt - Days - 1)
'
For i = pnt To Days + pnt - 1
'
If (pHigh(i) <> 0) Then
'
If (pHigh(i) > HighMax) Then HighMax =
pHigh(i)
'
End If
'
Next
'
For i = pnt To Days + pnt - 1
'
If (pLow(i) <> 0) Then
'
If (pLow(i) < LowMin) Then LowMin = pLow(i)
'
End If
'
Next
'
If (pYD3(Int(Days - 1 + pnt)) <> 0) Then
'
pKperiod(pnt) = ((pYD3(Int(Days - 1 + pnt)) LowMin) / (HighMax - LowMin)) * 100#
'
End If
'
LowMin = 9999.9
'
HighMax = 0#
'
Next
'
'
For pnt = 0 To nCnt - 1 - SwFac
'
SlowK = 0
'
For q = pnt To SwFac + pnt - 1
'
SlowK = pKperiod(q) + SlowK
'
Next

'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'

pSlowOC(pnt) = SlowK / SwFac


Pego1.YData(9, Days + pnt + SwFac) = pSlowOC(pnt)
Next
For pnt = 0 To nCnt - 1 - Dperiod
PercentD = 0
For q = pnt To Dperiod + pnt - 1
PercentD = pSlowOC(q) + PercentD
Next
Dfactor = PercentD / Dperiod
Pego1.YData(10, Days + pnt + Dperiod) = Dfactor
Next
'// Set the working axis extents
Pego1.WorkingAxis = 3
Pego1.ManualScaleControlY = PEMSC_MINMAX
Pego1.ManualMinY = 0
Pego1.ManualMaxY = 100
End Sub

ElseIf nChart = 31 Then


'****************************************************************
*****'
'****************************************************************
*****'
'031 Graph showing Subset Obstacles
'//! Note how annotation text does not overlap lines in
bottom axes.
'//! Left click and drag to zoom chart. Note how text
locations change as you zoom.
'//! Left click and drag annotation text to move annotation
text.
'//!
'//! This example demonstrates new annotation text
positioning logic which prevents all text
'//! from overlapping. It also shows how to 1) manually
position text with an annotation,
'//! 2) allow user to move annotation text, and 3) declare
subsets as obstacles so annotation text
'//! doesn't overlap subsets. It also ahows how to change
the default location where
'//! annotation text is automatically positioned.
'// Pass Data
Pego1.Subsets = 4
Pego1.Points = 100
Dim bAddAnnot As Boolean
Dim nCount As Integer

Dim szs(5) As String


szs(0) = "High"
szs(1) = "Medium High"
szs(2) = "Medium"
szs(3) = "Medium Low"
szs(4) = "Low"
bAddAnnot = False
nCount = 0
For p = 0 To 99
Pego1.YData(0, p) = 105# + (20 * Sin(0.1 * p)) + (5 *

Rnd)

Pego1.YData(1, p) = 105# + (20 * Sin(0.1 * p)) + (5 *


Rnd) + 30
Pego1.YData(2, p) = 105# + (20 * Sin(0.4 * p)) + (5 *
Rnd) + 30
Pego1.YData(3, p) = 105# + (20 * Sin(0.1 * p)) + (5 *
Rnd) + 20
If (bAddAnnot) Then
Pego1.GraphAnnotationX(nCount) = p + 1
Pego1.GraphAnnotationY(nCount) = Pego1.YData(1, p)
Pego1.GraphAnnotationText(nCount) = szs(Int(Rnd * 5))
Pego1.GraphAnnotationType(nCount) = PEGAT_POINTER
Pego1.GraphAnnotationAxis(nCount) = 1
nCount = nCount + 1
End If
bAddAnnot = Not bAddAnnot
Next p
'// The following code manully places annotation text at
separate coordinates than annotation. //
'// GraphAnnotationText has |H special justifation code which
signifies that coordinates follow. //
'// Note that coordinates are split and terminated with pipe
symbol. //
Pego1.GraphAnnotationX(nCount) = 20
Pego1.GraphAnnotationY(nCount) = 90
Pego1.GraphAnnotationText(nCount) = "|H33.0|120.0|Text offset
from pointer"
Pego1.GraphAnnotationType(nCount) = PEGAT_POINTER
'// Set Plotting Methods per Subset //
Pego1.PlottingMethods(0) = PEGPM_BAR
Pego1.PlottingMethods(1) = PEGPM_LINE
Pego1.PlottingMethods(2) = PEGPM_POINTSPLUSBFCGRAPHED
Pego1.PlottingMethods(3) = PEGPM_STEP
Pego1.BestFitDegree = PEBFD_4TH
'// Designate 2nd, 3rd, and 4th subset as obstacles //

Pego1.SubsetObstacles(0)
Pego1.SubsetObstacles(1)
Pego1.SubsetObstacles(2)
Pego1.SubsetObstacles(3)

=
=
=
=

False
True
True
True

'// This code replaces the first default text location


attempted for automatic text placement //
'// Setting to 270 causes text to be centered above
annotation location if no obstacle is found //
Pego1.GraphAnnotTextLocation(0) = 270
'// Show annotations and allow graph hot spots and moveable
annotation text //
Pego1.ShowAnnotations = True
Pego1.AllowGraphAnnotHotSpots = True
Pego1.GraphAnnotMoveable = PEGAM_POINTER
'// Split up subsets among different axes //
Pego1.MultiAxesSubsets(0) = 1
Pego1.MultiAxesSubsets(1) = 3
Pego1.MultiAxesProportions(0) = 0.3
Pego1.MultiAxesProportions(1) = 0.7
Pego1.MainTitle = "Drag a string"
Pego1.SubTitle = ""
Pego1.FocalRect = False
Pego1.GridLineControl = PEGLC_NONE
Pego1.AllowZooming = PEAZ_HORIZONTAL
Pego1.ZoomStyle = PEZS_RO2_NOT
'// Subset labels //
Pego1.SubsetLabels(0)
Pego1.SubsetLabels(1)
Pego1.SubsetLabels(2)
Pego1.SubsetLabels(3)

=
=
=
=

"Texas"
"Florida"
"Washington"
"California"

'// Subset colors //


Pego1.SubsetColors(0)
Pego1.SubsetColors(1)
Pego1.SubsetColors(2)
Pego1.SubsetColors(3)

=
=
=
=

Pego1.PEargb(255,
Pego1.PEargb(255,
Pego1.PEargb(255,
Pego1.PEargb(255,

'// Subset line types //


Pego1.SubsetLineTypes(0)
Pego1.SubsetLineTypes(1)
Pego1.SubsetLineTypes(2)
Pego1.SubsetLineTypes(3)

=
=
=
=

192, 192, 198)


0, 198, 198)
198, 198, 0)
0, 198, 0)

PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID

'// Various other features //


Pego1.FixedFonts = True
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_LIGHT_LINE

Pego1.SimplePointLegend = True
Pego1.SimpleLineLegend = True
Pego1.LegendStyle = PELS_1_LINE
Pego1.GraphAnnotationTextSize = 85
Pego1.AllowAnnotationControl = True
Pego1.MarkDataPoints = True
Pego1.MultiAxisStyle = PEMAS_SEPARATE_AXES
Pego1.MultiAxisStyleMenu = PEMC_SHOW
Pego1.LegendLocationMenu = PEMC_SHOW
Pego1.AllowStep = True
Pego1.DataShadows = PEDS_SHADOWS
Pego1.GradientBars = 8
Pego1.TextShadows = PETS_BOLD_TEXT
Pego1.MainTitleBold = True
Pego1.SubTitleBold = True
Pego1.LabelBold = True
Pego1.LineShadows = True
Pego1.FontSize = PEFS_MEDIUM
Pego1.PointsToGraph = 50
'// v7.2 new features //
Pego1.PointGradientStyle = PEPGS_RADIAL_TOP_LEFT
Pego1.PointBorderColor = Pego1.PEargb(100, 0, 0, 0)
Pego1.LineSymbolThickness = 3
Pego1.AreaBorder = 1
'// Improves metafile export //
Pego1.DpiX = 600
Pego1.DpiY = 600
Pego1.ExportSizeDef = PEESD_NO_SIZE_OR_PIXEL
Pego1.ExportTypeDef = PEETD_PNG
Pego1.ExportDestDef = PEEDD_CLIPBOARD
Pego1.ExportUnitXDef = "1280"
Pego1.ExportUnitYDef = "768"
Pego1.ExportImageDpi = 300
Pego1.AllowSvgExport = True
Pego1.RenderEngine = PERE_DIRECT2D
Pego1.AntiAliasGraphics = True
Pego1.AntiAliasText = True
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 32 Then
'****************************************************************
*****'
'****************************************************************
*****'

'032

Graph showing 16 axes

'//! Version 6 adds support for up to 16 left and 16 right y


axes.
'//! Also added is AxisBackColor, AxisForeColor, and
AxisBorderType.
'//! Select Graph menu from within the View menu to maximize
this example.
'// Disable Banding //
Pego1.GridBands = False
Pego1.PrepareImages = True
'// Pass Data //
Pego1.Subsets = 32
Pego1.Points = 100
Dim fRnd As Single
For s = 0 To 31
fRnd = Rnd(9) + 2

p))

'// pass 100 points of subset data //


For p = 0 To 99
Pego1.YData(s, p) = 10# + (0.6 * fRnd * Sin(fRnd *
Next p
'// set subsetlabel //
Pego1.SubsetLabels(s) = "Sin" + Format(fRnd, ".#")
Next s
'// Set various axis parameters //
Dim axis As Integer
For axis = 0 To 15
Pego1.WorkingAxis = axis
Pego1.ShowYAxis = PESA_GRIDNUMBERS
'// set y axis label //
Pego1.YAxisLabel = "Axis" + Str$(axis + 1)
Pego1.ManualScaleControlY = PEMSC_MINMAX
Pego1.ManualMinY = 0
Pego1.ManualMaxY = 20
Pego1.PlottingMethod = GPM_LINE
Pego1.ComparisonSubsets = 1
Pego1.PlottingMethodII = GPMII_STEP
Next axis
'// Set various subset parameters //
Dim dwArray(2) As Long

dwArray(0) = Pego1.PEargb(79, 0, 32, 198)


dwArray(1) = Pego1.PEargb(199, 225, 0, 0)
Dim nColorIndex As Integer
For s = 0 To 31
Pego1.SubsetLineTypes(s) = PELT_THIN_SOLID
Pego1.SubsetColors(s) = dwArray(nColorIndex)
nColorIndex = nColorIndex + 1
If (nColorIndex > 1) Then nColorIndex = 0
Next s
'// Set various point parameters //
For p = 0 To 99
Pego1.PointLabels(p) = "Data#" + Format(p + 1, "#")
Next p
Pego1.ForceVerticalPoints = PEFVP_HORZ
'// Various other features //
Pego1.FixedFonts = True
Pego1.FontSize = PEFS_SMALL
Pego1.FontSizeGlobalCntl = 0.9
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_LIGHT_NO_BORDER
Pego1.SimplePointLegend = True
Pego1.SimpleLineLegend = True
Pego1.LegendStyle = PELS_1_LINE_INSIDE_OVERLAP
'// Split up subsets among different axes //
Pego1.MultiAxesSubsets(0) = 2
Pego1.MultiAxesSubsets(1) = 2
Pego1.MultiAxesSubsets(2) = 2
Pego1.MultiAxesSubsets(3) = 2
Pego1.MultiAxesSubsets(4) = 2
Pego1.MultiAxesSubsets(5) = 2
Pego1.MultiAxesSubsets(6) = 2
Pego1.MultiAxesSubsets(7) = 2
Pego1.MultiAxesSubsets(8) = 2
Pego1.MultiAxesSubsets(9) = 2
Pego1.MultiAxesSubsets(10) = 2
Pego1.MultiAxesSubsets(11) = 2
Pego1.MultiAxesSubsets(12) = 2
Pego1.MultiAxesSubsets(13) = 2
Pego1.MultiAxesSubsets(14) = 2
Pego1.MultiAxesSubsets(15) = 2
Pego1.MultiAxisStyle = PEMAS_SEPARATE_AXES
Pego1.MultiAxisSeparatorSize = 65
Pego1.MultiAxisStyleMenu = PEMC_SHOW

Pego1.MainTitle = "16 Axes with axis forecolor backcolor


mouse control"
Pego1.SubTitle = ""
Pego1.FocalRect = False
Pego1.AllowZooming = PEAZ_HORZANDVERT
Pego1.ZoomStyle = PEZS_RO2_NOT
Pego1.AllowStep = True
Pego1.DataShadows = PEDS_NONE
Pego1.GradientBars = 12
Pego1.TextShadows = PETS_NO_TEXT
Pego1.MainTitleBold = True
Pego1.SubTitleBold = True
Pego1.LabelBold = True
Pego1.LineShadows = True
Pego1.PointsToGraph = 50
Pego1.GraphForeColor = Pego1.PEargb(50, 0, 0, 0)
Pego1.GridLineControl = PEGLC_BOTH
Pego1.GridStyle = PEGS_DOT
Pego1.BorderTypes = PETAB_SINGLE_LINE
'// v7.2 new features //
Pego1.PointGradientStyle = PEPGS_VERTICAL_ASCENT_INVERSE
Pego1.PointBorderColor = Pego1.PEargb(100, 0, 0, 0)
Pego1.LineSymbolThickness = 3
Pego1.AreaBorder = 1
'// Improves metafile export //
Pego1.DpiX = 600
Pego1.DpiY = 600
Pego1.ExportSizeDef = PEESD_NO_SIZE_OR_PIXEL
Pego1.ExportTypeDef = PEETD_PNG
Pego1.ExportDestDef = PEEDD_CLIPBOARD
Pego1.ExportUnitXDef = "1280"
Pego1.ExportUnitYDef = "768"
Pego1.ExportImageDpi = 300
Pego1.AllowSvgExport = True
Pego1.RenderEngine = PERE_DIRECT2D
Pego1.PEactions = REINITIALIZE_RESETIMAGE
'//////////////////////////////////
'// MouseMove Event Handler
//
'//////////////////////////////////
'
Private Sub Pego1_MouseMove(Button As Integer, Shift As
Integer, X As Single, Y As Single)
'
'
If Pego1.ProcessingMouseMove = True Then Exit Sub

'
'
'// If mouse is inside an axis, change it's back color to
WHITE //
'
'// Determine if mouse is within an axis //
'
'
Dim nLeft As Integer
'
Dim nTop As Integer
'
Dim nRight As Integer
'
Dim nBottom As Integer
'
Dim pX As Integer
'
Dim pY As Integer
'
Dim a As Integer
'
Dim nChangedAxisColor As Integer
'
nChangedAxisColor = -1
'
'
'// get last mouse location within control //'
'
Pego1.GetLastMouseMove pX, pY
'
'
For a = 0 To 15
'
'// test to see if this is within axis area //'
'
Pego1.WorkingAxis = a
'
Pego1.GetRectAxis nLeft, nTop, nRight, nBottom
'
'
If pX > nLeft And pX < nRight And pY > nTop And pY <
nBottom Then
'
If Pego1.AxisBackColor <> Pego1.PEargb(255, 255,
255, 255) Then
'
Pego1.AxisBackColor = Pego1.PEargb(255, 255,
255, 255)
'
Pego1.AxisForeColor = Pego1.PEargb(255, 255, 0,
0)
'
nChangedAxisColor = a
'
Exit For
'
End If
'
End If
'
Next a
'
'
If (nChangedAxisColor <> -1) Then
'
For a = 0 To 15
'
If (a <> nChangedAxisColor) Then
'
Pego1.WorkingAxis = a
'
Pego1.AxisBackColor = 1
'
Pego1.AxisForeColor = 1
'
End If
'
Next a
'
Pego1.PEactions = 0
'
End If

ElseIf nChart = 33 Then


'****************************************************************

*****'
'****************************************************************
*****'
'033 Graph showing subset order control
'//! Version 6 adds additional support to ease selecting and
ordering subsets.
'//! New features SubsetsToShow and SubsetsToTable control
visibility
'//! of subsets within the chart and table regions.
'//! SubsetsToShow not only controls visibility, but can also
control the order.
'//! RandomSubsetsToGraph can also control order and
visibility of subsets plotted.
Call CreateSimpleGraph
Pego1.PlottingMethod = GPM_BARSTACKED
Pego1.QuickStyle = PEQS_LIGHT_SHADOW
Pego1.LegendStyle = PELS_1_LINE
Pego1.LegendLocation = PELL_LEFT
'// Controlling order how subsets are plotted //
Pego1.RandomSubsetsToGraph(0) = 3
Pego1.RandomSubsetsToGraph(1) = 2
Pego1.RandomSubsetsToGraph(2) = 1
Pego1.RandomSubsetsToGraph(3) = 0
'// Controlling order of
Pego1.SubsetsToLegend(0)
Pego1.SubsetsToLegend(1)
Pego1.SubsetsToLegend(2)
Pego1.SubsetsToLegend(3)

items in legend //
= 0
= 1
= 2
= 3

'// Controlling order of items in table below chart //


Pego1.SubsetsToTable(0) = 0
Pego1.SubsetsToTable(1) = 1
Pego1.SubsetsToTable(2) = 2
Pego1.SubsetsToTable(3) = 3
Pego1.PEactions = REINITIALIZE_RESETIMAGE
ElseIf nChart = 34 Then
'****************************************************************
*****'
'****************************************************************
*****'
'034 Graph showing moveable table
'//! Version 6 adds pixel located table annotations with
built in logic to allow
'//! user to move the table annotation. See TAMoveable set

to True, and
'//! TALocation set to InsidePixelUnits.
dragging table.

Try clicking and

'//! Version 6 adds additional support to ease selecting and


ordering subsets.
'//! New features SubsetsToShow and SubsetsToTable control
visibility
'//! of subsets within the chart and table regions.
'//! SubsetsToShow not only controls visibility, but can also
control the order.
'//! RandomSubsetsToGraph can also control order and
visibility of subsets plotted.
Call CreateSimpleGraph
Pego1.PlottingMethod = GPM_HORZSTACKEDBAR
Pego1.LegendStyle = PELS_1_LINE
Pego1.LegendLocation = PELL_TOP
Pego1.ImageAdjustBottom = 50
Pego1.YAxisLabel = " "
Pego1.QuickStyle = PEQS_LIGHT_LINE
Pego1.DataShadows = PEDS_3D
'// Control which subsets to show //
'// Value [1 - 9] show subset, subsets with a value of 9 plot
before values of 1
'// Value [0] hides subset
Pego1.SubsetsToShow(0) = 2 ' 2 is just a weighted value, it
could be anything [1-9]
Pego1.SubsetsToShow(1) = 2
Pego1.SubsetsToShow(2) = 0
Pego1.SubsetsToShow(3) = 2
'// Construct a simple table annotation //
Pego1.WorkingTable = 0
Pego1.TARows = 5
Pego1.TAColumns = 2
'// Pass the table
Pego1.TAText(0, 0)
Pego1.TAText(1, 0)
Pego1.TAText(2, 0)
Pego1.TAText(3, 0)
Pego1.TAText(4, 0)
Pego1.TAText(0, 1)
'// Set to cell
Pego1.TAType(1,
Pego1.TAType(2,
Pego1.TAType(3,
Pego1.TAType(4,

text //
= "Subset "
= Pego1.SubsetLabels(0)
= Pego1.SubsetLabels(1)
= Pego1.SubsetLabels(2)
= Pego1.SubsetLabels(3)
= "Visible? "

types and attributes //


1) = LAT_LARGE_SQUARESOLID
1) = LAT_LARGE_SQUARESOLID
1) = LAT_LARGE_SQUARE
1) = LAT_LARGE_SQUARESOLID

Pego1.TAColor(1,
Pego1.TAColor(2,
Pego1.TAColor(3,
Pego1.TAColor(4,

1)
1)
1)
1)

Pego1.TAHotSpot(1,
Pego1.TAHotSpot(2,
Pego1.TAHotSpot(3,
Pego1.TAHotSpot(4,

=
=
=
=
1)
1)
1)
1)

Pego1.PEargb(255,
Pego1.PEargb(255,
Pego1.PEargb(255,
Pego1.PEargb(255,
=
=
=
=

255,
255,
255,
255,

0,
0,
0,
0,

0)
0)
0)
0)

True
True
True
True

'// Other Table Related Properties ///


Pego1.ShowTableAnnotation = True
Pego1.TALocation = PETAL_INSIDE_PIXEL_UNITS
Pego1.TAX = 50 '// initial setting, we set again further down
in code.
Pego1.TAY = 50
Pego1.TAMoveable = True
Pego1.TABackColor = Pego1.PEargb(129, 255, 255, 255)
Pego1.TAHeaderRows = 0
Pego1.TAHeaderColumn = False
Pego1.TABorder = PETAB_INSET
Pego1.TATextSize = 85
'// Construct a simple text table annotation //
Pego1.WorkingTable = 1
Pego1.TARows = 1
Pego1.TAColumns = 1
Pego1.TATextMode = True
Dim n As Byte
Dim tstr As String
tstr = "This is a test to see how this works. "
tstr = tstr + Chr$(10)
tstr = tstr + "Second paragraph, this is a test to see how
this works. "
tstr = tstr + Chr$(10)
tstr = tstr + "Third paragraph, this is a test to see how
this works."
Pego1.TAText(0, 0) = tstr
'// Other Table Related Properties ///
Pego1.ShowTableAnnotation = True
Pego1.TALocation = PETAL_INSIDE_PIXEL_UNITS
Pego1.TAX = 50 '// initial setting, we set again further down
in code.
Pego1.TAY = 50
Pego1.TAWidth = 150
Pego1.TAMoveable = PETAM_FULL
Pego1.TABackColor = Pego1.PEargb(159, 255, 255, 255)
Pego1.TAHeaderRows = 0

Pego1.TAHeaderColumn = False
Pego1.TATextSize = 95
Pego1.TABorder = PETAB_INSET
Pego1.RenderEngine = PERE_DIRECT2D
Pego1.AntiAliasGraphics = True
Pego1.AntiAliasText = True
'// Initialize chart to get graph border rectangle //
Pego1.PEactions = 0
Dim nLeft As Integer
Dim nTop As Integer
Dim nRight As Integer
Dim nBottom As Integer
Call Pego1.GetRectGraph(nLeft, nTop, nRight, nBottom)
Pego1.WorkingTable = 0
Pego1.TAX = nRight - 150
Pego1.TAY = nTop + 25
Pego1.WorkingTable = 1
Pego1.TAX = nLeft + 50
Pego1.TAY = nTop + 25
Pego1.WorkingTable = 0
Pego1.PEactions = REINITIALIZE_RESETIMAGE
'////////////////////////////////////
'// TableAnnotation Hot Spot Event //
'////////////////////////////////////
'
Private Sub Pego1_TableAnnotation(DblClk As Integer, nIndex
As Integer, nRow As Long, nColumn As Long)
'
'
'// Look for table hot spot and change which subsets are
visible //
'
Dim nHotSpotType As Integer
'
Dim lExtra1 As Long
'
Dim lExtra2 As Long
'
'
Call Pego1.GetHotSpotData(nHotSpotType, lExtra1,
lExtra2)
'
'
If (nHotSpotType = PEHS_TABLEANNOTATION + 0) Then '//
zero represents first table annotation
'
'// If TYPE is SQUARESOLID, change to SQUARE and
vice versa. //
'
Dim nType As Integer
'
nType = Pego1.TAType(lExtra1, lExtra2)
'
'
If (nType = PEGAT_LARGESQUARE) Then

'
Pego1.TAType(lExtra1, lExtra2) =
LAT_LARGE_SQUARESOLID
'
Pego1.SubsetsToShow(lExtra1 - 1) = 2
just an arbitrary weight
'
Else
'
Pego1.TAType(lExtra1, lExtra2) =
LAT_LARGE_SQUARE
'
Pego1.SubsetsToShow(lExtra1 - 1) = 0
hides subset
'
End If
'
'
Pego1.PEactions = 0
'
End If
'
'
End Sub

'// 2 is

'// 0

ElseIf nChart = 35 Then


'****************************************************************
*****'
'****************************************************************
*****'
'035 Graph showing Demographic Pyramid
'//! Version 6 adds a simple demographic pyramid plotting
method.
'//! This feature represents a new mode of drawing data and
axes, a special case
'//! not compatible with mixing plotting styles and full
zooming.
'//! Best to set AllowPlotCustomization = False, and
'//! AllowZooming = PEAZ_NONE or PEAZ_HORIZONTAL.
'//! Also note graph annotations take special positioning as
demonstrated below.
Call CreateSimpleGraph
'// Change Data //
Pego1.Subsets = 2
Pego1.Points = 17
'// Set Title //
Pego1.MainTitle = "Demographic Pyramid"
'// Create some Y Data //
Pego1.YData(0, 0) = 0.1: Pego1.YData(0,
Pego1.YData(0, 2) = 0.5
Pego1.YData(0, 3) = 0.6: Pego1.YData(0,
Pego1.YData(0, 5) = 1.5
Pego1.YData(0, 6) = 1.2: Pego1.YData(0,
Pego1.YData(0, 8) = 1.8
Pego1.YData(0, 9) = 2.2: Pego1.YData(0,

1) = 0.15:
4) = 0.7:
7) = 1.7:
10) = 3.2:

Pego1.YData(0, 11)
Pego1.YData(0,
Pego1.YData(0, 14)
Pego1.YData(0,

= 4.3
12) = 5.1: Pego1.YData(0, 13) = 6.5:
= 7.2
15) = 8.3: Pego1.YData(0, 16) = 9.3

Pego1.YData(1, 0) = 0.3: Pego1.YData(1, 1) = 0.35:


Pego1.YData(1, 2) = 0.36
Pego1.YData(1, 3) = 0.5: Pego1.YData(1, 4) = 0.6:
Pego1.YData(1, 5) = 0.8
Pego1.YData(1, 6) = 1.1: Pego1.YData(1, 7) = 1.9:
Pego1.YData(1, 8) = 2.9
Pego1.YData(1, 9) = 3.6: Pego1.YData(1, 10) = 4.2:
Pego1.YData(1, 11) = 5.3
Pego1.YData(1, 12) = 6.1: Pego1.YData(1, 13) = 7.15:
Pego1.YData(1, 14) = 8.2
Pego1.YData(1, 15) = 9.3: Pego1.YData(1, 16) = 9.3
'// Set Subset Labels //
Pego1.SubsetLabels(0) = "MALE"
Pego1.SubsetLabels(1) = "FEMALE"
'// Set Legend to Bottom //
Pego1.LegendLocation = PELL_BOTTOM
'// Set Legend Style to Two Line, by default will position
next to each half //
Pego1.LegendStyle = PELS_2_LINE
'// Set Point Labels //
Pego1.PointLabels(0) = "80+"
Pego1.PointLabels(1) = "75-79"
Pego1.PointLabels(2) = "70-74"
Pego1.PointLabels(3) = "65-69"
Pego1.PointLabels(4) = "60-64"
Pego1.PointLabels(5) = "55-59"
Pego1.PointLabels(6) = "50-54"
Pego1.PointLabels(7) = "45-49"
Pego1.PointLabels(8) = "40-44"
Pego1.PointLabels(9) = "35-39"
Pego1.PointLabels(10) = "30-34"
Pego1.PointLabels(11) = "25-29"
Pego1.PointLabels(12) = "20-24"
Pego1.PointLabels(13) = "15-19"
Pego1.PointLabels(14) = "10-14"
Pego1.PointLabels(15) = "05-09"
Pego1.PointLabels(16) = "00-04"
'// Set plotting method //
Pego1.PlottingMethod = GPM_DEMOGRAPHICPYRAMID
'// Disable incompatible features //
Pego1.AllowZooming = PEAZ_NONE

Pego1.AllowPlotCustomization = False
'// Auto scaling is supported, and note how manually scaling
axes, causes a mirrored effect //
Pego1.ManualMinY = 0#
Pego1.ManualMaxY = 10#
Pego1.ManualScaleControlY = PEMSC_MINMAX
'// Place axis on bottom, since horizontal mode, right y axis
is bottom y axis //
Pego1.YAxisOnRight = True
'// Hide Y axis label //
Pego1.ShowYAxis = PESA_GRIDNUMBERS
'// Note below how graph annotations are positioned on each
side of chart. //
Pego1.GraphAnnotationX(0) = 3#
Pego1.GraphAnnotationY(0) = 5 - (Pego1.YData(0, 2) / 2)
'
5 is middle of axis, (10-0) / 2, and note subtracting half
Pego1.GraphAnnotationType(0) = PEGAT_POINTER_ARROW_SMALL
'
of value to position data
Pego1.GraphAnnotationText(0) = "Arrow 1"
Pego1.GraphAnnotationColor(0) = Pego1.PEargb(255, 198, 0, 0)
Pego1.GraphAnnotationX(1) = 8#
Pego1.GraphAnnotationY(1) = 5 + (Pego1.YData(1, 7) / 2)
5 is middle of axis, (10-0) / 2, and note adding half
Pego1.GraphAnnotationType(1) = PEGAT_POINTER_ARROW_SMALL
of value to position data
Pego1.GraphAnnotationText(1) = "Arrow 2"
Pego1.GraphAnnotationColor(1) = Pego1.PEargb(255, 0, 198,
198)
Pego1.ShowAnnotations = True
'// Increase annotation font //
Pego1.GraphAnnotationTextSize = 100
'// Designate subsets obstacles //
Pego1.SubsetObstacles(0) = True
Pego1.SubsetObstacles(1) = True
'// Allow user to move ArrowPointer annotation //
Pego1.GraphAnnotMoveable = PEGAM_POINTER
Pego1.AllowGraphAnnotHotSpots = True
'// Increase all font sizes //
Pego1.FontSizeGlobalCntl = 1.2
'// No text shadows //
Pego1.TextShadows = PETS_NO_TEXT

'
'

'// Set colors //


Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_DARK_NO_BORDER
'// Make bars 3D //
Pego1.DataShadows = PEDS_3D
Pego1.RenderEngine = PERE_DIRECT2D
Pego1.AntiAliasGraphics = True
Pego1.AntiAliasText = True
Pego1.ImageAdjustLeft = 75
Pego1.PEactions = REINITIALIZE_RESETIMAGE
End If
'// called above Pego1.PEactions = REINITIALIZE_RESETIMAGE
Form2.Visible = True
Unload
Unload
Unload
Unload

Form3
Form4
Form5
Form6

End Sub
Public Sub CreateSimpleGraph()
'//! Right button click to show popup menu. //
'//! Double Click to show customization dialog. //
'//! Left-Click and drag to draw zoom box. Use popup memu or
'z' to undo zoom. //
'// Simple example show the basics of a graph object. //
'// Graph's generally only contain YData because we assume
'// data is plotted equally spaced left to right.
Dim s As Long
Dim p As Long
'// Enable Bar Glass Effect //
Pego1.BarGlassEffect = True
'// Enable Plotting style gradient and bevel features //
Pego1.AreaGradientStyle = PEPGS_RADIAL_BOTTOM_RIGHT
Pego1.AreaBevelStyle = PEBS_MEDIUM_SMOOTH
Pego1.SplineGradientStyle = PEPGS_RADIAL_BOTTOM_RIGHT
Pego1.SplineBevelStyle = PESBS_MEDIUM_SMOOTH

'// v7.2 new features //


Pego1.PointGradientStyle = PEPGS_VERTICAL_ASCENT_INVERSE
Pego1.PointBorderColor = Pego1.PEargb(100, 0, 0, 0)
Pego1.LineSymbolThickness = 3
Pego1.AreaBorder = 1
Pego1.AllowSvgExport = True
'// Prepare images in memory //
Pego1.PrepareImages = True
'// Pass Data //
Pego1.Subsets = 4
Pego1.Points = 12
For s = 0 To 3
For p = 0 To 11
Pego1.YData(s, p) = ((p + 1) * 50) + (Rnd() * 250) +
2 + 700# - ((s * 140#))
Next p
Next s
Pego1.DataShadows = PEDS_SHADOWS
Pego1.FocalRect = False
Pego1.PlottingMethod = GPM_AREA
Pego1.GridLineControl = PEGLC_BOTH
Pego1.GridStyle = PEGS_DOT
Pego1.AllowRibbon = True
Pego1.AllowZooming = PEAZ_HORZANDVERT
Pego1.ZoomStyle = PEZS_RO2_NOT
'// Enable middle mouse dragging //
Pego1.MouseDraggingX = True
Pego1.MouseDraggingY = True
Pego1.MainTitle = "Units Sold per Month"
Pego1.SubTitle = ""
Pego1.YAxisLabel = "Units Sold"
Pego1.XAxisLabel = "Month"
'// subset labels //
Pego1.SubsetLabels(0)
Pego1.SubsetLabels(1)
Pego1.SubsetLabels(2)
Pego1.SubsetLabels(3)
'// point labels //
Pego1.PointLabels(0)
Pego1.PointLabels(1)
Pego1.PointLabels(2)
Pego1.PointLabels(3)
Pego1.PointLabels(4)
Pego1.PointLabels(5)

=
=
=
=
=
=
=
=
=
=

"Texas"
"Florida"
"Washington"
"California"
"January"
"February"
"March"
"April"
"May"
"June"

Pego1.PointLabels(6) = "July"
Pego1.PointLabels(7) = "August"
Pego1.PointLabels(8) = "September"
Pego1.PointLabels(9) = "October"
Pego1.PointLabels(10) = "November"
Pego1.PointLabels(11) = "December"
'// subset colors //
Pego1.SubsetColors(0)
Pego1.SubsetColors(1)
Pego1.SubsetColors(2)
Pego1.SubsetColors(3)

=
=
=
=

Pego1.PEargb(128,
Pego1.PEargb(128,
Pego1.PEargb(128,
Pego1.PEargb(128,

'// subset line types //


Pego1.SubsetLineTypes(0)
Pego1.SubsetLineTypes(1)
Pego1.SubsetLineTypes(2)
Pego1.SubsetLineTypes(3)
Pego1.SubsetLineTypes(4)
Pego1.SubsetLineTypes(5)
Pego1.SubsetLineTypes(6)
Pego1.SubsetLineTypes(7)
'// subset point types //
Pego1.SubsetPointTypes(0)
Pego1.SubsetPointTypes(1)
Pego1.SubsetPointTypes(2)
Pego1.SubsetPointTypes(3)
Pego1.SubsetPointTypes(4)
Pego1.SubsetPointTypes(5)
Pego1.SubsetPointTypes(6)
Pego1.SubsetPointTypes(7)

=
=
=
=
=
=
=
=

198, 0, 0)
0, 198, 198)
198, 198, 0)
0, 198, 0)

PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
=
=
=
=
=
=
=
=

PEPT_DOTSOLID
PEPT_UPTRIANGLESOLID
PEPT_SQUARESOLID
PEPT_DOWNTRIANGLESOLID
PEPT_DOTSOLID
PEPT_SQUARESOLID
PEPT_DIAMONDSOLID
PEPT_UPTRIANGLESOLID

Pego1.SimplePointLegend = True
Pego1.SimpleLineLegend = True
Pego1.LegendStyle = PELS_1_LINE
'// Allow stacked type graphs //
Pego1.NoStackedData = False
'// Various other features //
Pego1.FixedFonts = True
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_MEDIUM_LINE
Pego1.GradientBars = 8
Pego1.LineShadows = True
Pego1.MainTitleBold = True
Pego1.SubTitleBold = True
Pego1.LabelBold = True
Pego1.TextShadows = PETS_BOLD_TEXT
Pego1.FontSize = PEFS_LARGE

Pego1.DataPrecision = PEDP_ONEDECIMAL
Pego1.GraphPlusTable = PEGPT_BOTH
Pego1.MarkDataPoints = False
Pego1.ImageAdjustLeft = 20
Pego1.ImageAdjustRight = 20
Pego1.ImageAdjustBottom = 10
'// Set various export defaults //
Pego1.DpiX = 600
Pego1.DpiY = 600
Pego1.ExportSizeDef = PEESD_NO_SIZE_OR_PIXEL
Pego1.ExportTypeDef = PEETD_PNG
Pego1.ExportDestDef = PEEDD_CLIPBOARD
Pego1.ExportUnitXDef = "1280"
Pego1.ExportUnitYDef = "768"
Pego1.ExportImageDpi = 300
Pego1.AllowSvgExport = True
Pego1.RenderEngine = PERE_DIRECT2D
Pego1.AntiAliasGraphics = True
Pego1.AntiAliasText = True
'// Always call PEactions at end **'
'// as this func is designed for pre-initialization, avoid
Pego1.PEactions = REINITIALIZE_RESETIMAGE till later
End Sub
Private Sub Pego1_TableAnnotation(DblClk As Integer, nIndex As
Integer, nRow As Long, nColumn As Long)
Dim nChart As Integer
Dim s As String
If Form1.List1.ListIndex < 0 Then Exit Sub
s = Form1.List1.List(Form1.List1.ListIndex)
s = left$(s, 3)
nChart = CInt(s)
If (nChart = 30) Then
Dim i As Long
If (nIndex = 0) Then ' // zero represents first table
annotation
Pego1.ZoomMode = False
Pego1.PointsToGraph = 0
'// Change color of selected table item //
For i = 1 To 10
Pego1.TAColor(i, 0) = Pego1.PEargb(255, 142, 142,

142)

Next
Pego1.TAColor(nRow, nColumn) = Pego1.PEargb(255, 198,

0, 0)

Dim szSym As String


szSym = LTrim$(Pego1.TAText(nRow, nColumn))
'// OK, Change Data //
LoadData (szSym)
Pego1.PEreinitialize
Pego1.PEresetimage 0, 0
Call InvalidateRect(Pego1.hWnd, 0, 0)
End If
ElseIf (nChart = 34) Then
'// Look for table hot spot and change which subsets are
visible //
Dim nHotSpotType As Integer
Dim lExtra1 As Long
Dim lExtra2 As Long
Call Pego1.GetHotSpotData(nHotSpotType, lExtra1, lExtra2)
If (nHotSpotType = PEHS_TABLEANNOTATION + 0) Then '//
zero represents first table annotation
'// If TYPE is SQUARESOLID, change to SQUARE and vice
versa. //
Dim nType As Integer
nType = Pego1.TAType(lExtra1, lExtra2)
If (nType = PEGAT_LARGESQUARE) Then
Pego1.TAType(lExtra1, lExtra2) =
LAT_LARGE_SQUARESOLID
Pego1.SubsetsToShow(lExtra1 - 1) = 2
'// 2 is
just an arbitrary weight
Else
Pego1.TAType(lExtra1, lExtra2) = LAT_LARGE_SQUARE
Pego1.SubsetsToShow(lExtra1 - 1) = 0
'// 0
hides subset
End If
Pego1.PEactions = 0
End If
End If
End Sub

Private Sub Timer1_Timer()


Dim CurrentTime As String
Dim test As Long
Dim nChart As Integer
Dim s As String
If Form1.List1.ListIndex < 0 Then Exit Sub
s = Form1.List1.List(Form1.List1.ListIndex)
s = left$(s, 3)
nChart = CInt(s)
If nChart = 17 Then
'********************************************'
'** IMPORTANT FOR REALTIME IMPLEMENTATIONS **'
'********************************************'
' Be sure to set ManualScaleControl,
'
ManualMaxY, and ManualMinY
' Be sure to set ManualMaxDataString
' Be sure to set ManualMaxPointLabel
' Be sure to set NoStackedData to TRUE
' Be sure to set NoRandomPointsToGraph to TRUE
' Be sure to set AllowHistogram to FALSE
' Be sure to use PEP_szaAPPENDPOINTLABELDATA
'
before PEP_faAPPENDYDATA
'********************************************'
'********************************************'
'** new point label **'
CurrentTime = Time$
'** new YData **'
ReDim NewData(2) As Single
NewData(0) = (Rnd * 60) + 2
NewData(1) = (Rnd * 90) + 2
'** transfer new point label **'
Call PEvset(Pego1.hObject, PEP_szaAPPENDPOINTLABELDATA, ByVal
CurrentTime, 1)

1)

'** transfer new YData **'


'** this will also update and view new image **'
test = PEvset(Pego1.hObject, PEP_faAPPENDYDATA, NewData(0),

'////////////////////////////////////////////////////////////////
//'

'// To alter this code (case 17) to cause appended data to


//'
'// from a server, comment out all above code and replace
with
//'
'// code below. See the main ReadMe file for instructions on
//'
'// creating the Virtual Directory Pe6WebDemo so web demo
runs. //'
'// For more info, see Chapter 1 Pedo ProEssentials Data
Object //'
come

'////////////////////////////////////////////////////////////////
//'
'Pego1.AppendFromURL
("http://localhost/Pe6WebDemo/IEStripChart/WebForm3.aspx")
End If
If nChart = 20 Then
If m_nRealTimeCounter >= 15000 Then
'// When we reach the end of our data, we shift 20% to the
'// left and make room for another 3000 quick updates.
ReDim NewData(6000) As Single
Call PEvset(Pego1.hObject, PEP_szaAPPENDPOINTLABELDATA,
ByVal 0&, 3000)
Call PEvset(Pego1.hObject, PEP_faAPPENDYDATA, NewData(0),
3000)
'// We need to perform a complete image update here.
Pego1.PEactions = RESET_IMAGE
Pego1.PEactions = INVALIDATE_RECT
Call UpdateWindow(Pego1.hWnd)
m_nRealTimeCounter = 12000
End If
'// First Subset //
Pego1.YData(0, m_nRealTimeCounter) = (Sin(0.003 *
m_nSinCounter) * 500#)
'// Second Subset //
Pego1.YData(1, m_nRealTimeCounter) = (Cos(0.003 *
m_nSinCounter) * 500#)
'// Set an example string associated with data //
Pego1.PointLabels(m_nRealTimeCounter) = "Test" + Str$
(m_nSinCounter)
'// This call performs a quick partial draw to an internal
cached bmp //'

Pego1.PEpartialresetimage m_nRealTimeCounter, 1
'// Invalidate control, only invalidate vertical charting
area and
'// approximate horizontal location of new data added.
Dim nA As Long
Dim nX As Long
Dim nY As Long
Dim fX As Double
Dim fY As Double
Dim nTop As Integer
Dim nLeft As Integer
Dim nRight As Integer
Dim nBottom As Integer
Dim r As Rect
nA = 0
'// Initialize axis, non-zero only if using
MultiAxesSubsets
fX = m_nRealTimeCounter - 5#
'// Approximate horizontal
location
fY = 0
'// not important, we will user vertical extents
from PEP_rectGRAPH
'// This call finds pixel location for fX and fY graph
coordinates //'
Pego1.PEconvpixeltograph nA, nX, nY, fX, fY, 0, 0, 1
'// get vertical extents of charting area //'
Pego1.GetRectGraph nLeft, nTop, nRight, nBottom
nLeft = nX
nRight = nX + 50 '// 50 pixels close to new data location
//

'// For comparison purposes, you can uncomment the line below

'// Calling PEresetimage with each timer event causes CPU


usage to go to 100%
'// PEpartialresetimage allows the same visual output while
using 2% or less of the CPU
'// Pego1.PEresetimage 0, 0
'// Call Windows API to only invalidate what needs
invalidating //'
r.left = nLeft
r.top = nTop
r.bottom = nBottom
r.right = nRight
Call InvalidateRect(Pego1.hWnd, r, False)
m_nRealTimeCounter = m_nRealTimeCounter + 1
m_nSinCounter = m_nSinCounter + 1

End If
End Sub
Public Sub LoadData(newName As String)
'// Function to load financial data from a comma delimited
file //
Dim szFile As String
szFile = App.Path + "\" + newName + ".txt"
ReDim Y1(1000) As Single
ReDim Y2(1000) As Single
ReDim y3(1000) As Single
ReDim y4(1000) As Single
ReDim y5(1000) As Single
ReDim X0(1000) As Double
ReDim Xs(1000) As String
Dim c As Long
Dim i As Long
Dim s As String
Dim d As Date
Dim day As Long
Dim month As Long
Dim year As Long
Dim sDate As String
Dim sOpen As String
Dim sHigh As String
Dim sLow As String
Dim sClose As String
Dim sVolume As String
Dim dstart As Double
Dim nCnt As Long
'// Open Data File //
Open szFile For Input As #1
Do While Not EOF(1)
' Loop until end of file.
Input #1, sDate, sOpen, sHigh, sLow, sClose, sVolume
'// Get date and transfer into a number
year = Val(Mid$(sDate, 1, 2))
If year > 90 Then
year = year + 1900
ElseIf year < 10 Then
year = year + 2000
End If
month = Val(Mid$(sDate, 3, 2))
day = Val(Mid$(sDate, 5, 2))
Xs(c) = LTrim$(Str$(month)) + "/" + LTrim$(Str$(day)) +
"/" + LTrim$(Str$(year))

d = CDate(LTrim$(Str$(month)) + "/" + LTrim$(Str$(day)) +


"/" + LTrim$(Str$(year)))
X0(c) = CDbl(d) + 0.5 '// .5 means Give daily data a time
of noon
'// store Open, High, Low, Close, and Volume //
Y1(c) = CSng(sOpen)
Y2(c) = CSng(sHigh)
y3(c) = CSng(sLow)
y4(c) = CSng(sClose)
y5(c) = CSng(sVolume)
c = c + 1
Loop
Close #1
'// Pass data into chart //
nCnt = c - 1
Pego1.StartTime = X0(0) 'dstart
Pego1.Subsets = 11
Pego1.Points = nCnt
Pego1.UsingXDataII = True
'//! Empty data so we can make sure we are completely
resetting //
Pego1.YData(0, -1) = 0
Pego1.XDataII(0, -1) = 0
Pego1.PointLabels(-1) = "0" '//! note 0 in quotes
'//! -1 above is a special index that tells ProEssentials you
are resizing property
For i = 0 To (nCnt - 1)
Pego1.YData(0, i) = Y2(i) '// high
Pego1.YData(1, i) = y3(i) '// low
Pego1.YData(2, i) = Y1(i) '// open
Pego1.YData(3, i) = y4(i) '// close
Pego1.YData(7, i) = y5(i) '// volume
Pego1.XDataII(0, i) = X0(i)
Pego1.PointLabels(i) = Xs(i)
Next i
'// We now have data, let's make some studies //
'////////////////////////////////////////////////////////////////
////
'// Bollinger Bands //
'/////////////////////
Dim ID As Long
Dim f As Single
Dim Days As Double

Dim
Dim
Dim
Dim
Dim
Dim

pnt As Long
Total As Double
Total2 As Double
x As Long
SMAfBB As Double
BBNum As Double

x = 1
ReDim pYD3(nCnt) As Single
For pnt = 0 To (nCnt - 1)
pYD3(pnt) = Pego1.YData(3, pnt)
Next
'// Middle Band = SMA
Days = 20
For pnt = 0 To (nCnt - Days - 1)
Total = 0
For i = 0 + pnt To Days + pnt - 1
Total = Total + pYD3(i)
Next
f = Total / Days
Pego1.YData(5, pnt + Days - 1) = f
Next
'// Upper Band = Middle Band + [Standard Deviation * Square
Root{[Sum for x Days((Closing Price - Middle Band)^2)]/Days]
For pnt = 0 To (nCnt - Days - 1)
Total = 0
For i = 0 + pnt To Days + pnt - 1
Total = Total + pYD3(i)
Next
SMAfBB = Total / Days
'// Find sum of Closing Price minus SMA over days and
square
BBNum = 0
For i = 0 + pnt To Days + pnt - 1
BBNum = ((pYD3(i) - SMAfBB) * (pYD3(i) - SMAfBB)) +
BBNum
Next
f = SMAfBB + 2# * Sqr(BBNum / Days)
Pego1.YData(4, pnt + Days - 1) = f
Next
'// Lower Band = Middle Band - [Standard Deviation * Square
Root{[Sum for x Days((Closing Price - Middle Band)^2)]/Days]
For pnt = 0 To (nCnt - Days - 1)
Total = 0
For i = 0 + pnt To Days + pnt - 1
Total = Total + pYD3(i)
Next

SMAfBB = Total / Days


'// Find sum of Closing Price minus SMA over days and
square

BBNum

BBNum = 0
For i = 0 + pnt To Days + pnt - 1
BBNum = ((pYD3(i) - SMAfBB) * (pYD3(i) - SMAfBB)) +
Next
f = SMAfBB - 2# * Sqr(BBNum / Days)
Pego1.YData(6, pnt + Days - 1) = f

Next
'////////////////////////////////////////////////////////////////
////////////////////
'// Relative Strength Index //
'/////////////////////////////
Total = 0
Total2 = 0
Dim RS As Single
Dim RSI As Single
x = 1
Dim LowerCount As Long
Dim UpperCount As Long
'// How many days do you want to check
Days = 10
ReDim pUpperArray(nCnt) As Single
ReDim pLowerArray(nCnt) As Single
For i = 1 To Days
If ((pYD3(i) - pYD3(i - 1))
pLowerArray(LowerCount)
LowerCount = LowerCount
Else
pUpperArray(UpperCount)
UpperCount = UpperCount
End If
Next

< 0) Then
= (pYD3(i) - pYD3(i - 1))
+ 1
= (pYD3(i) - pYD3(i - 1))
+ 1

'// Total the amounts over the period


Total = 0
For i = 0 To LowerCount - 1
Total = pLowerArray(i) + Total
Next
Total2 = 0
For i = 0 To UpperCount - 1
Total2 = pUpperArray(i) + Total2
Next
'// Divide up by down

RS = (Total2 / Days) / (Abs(Total) / Days)


'// Use the RSI formula
RSI = 100# - (100# / (1# + RS))
Pego1.YData(8, Days - 1) = RSI
For i = Days To nCnt - 1
If (pYD3(i) <> 0 And pYD3(i - 1) <> 0) Then
Total = Total * (Days - 1)
Total2 = Total2 * (Days - 1)
If ((pYD3(i) - pYD3(i - 1)) < 0) Then
Total = (pYD3(i) - pYD3(i - 1)) + Total
Else
Total2 = (pYD3(i) - pYD3(i - 1)) + Total2
End If
Total = Total / Days
Total2 = Total2 / Days
RS = (Total2) / (Abs(Total))
RSI = 100# - (100# / (1# + RS))
Pego1.YData(8, Days - 1 + i) = RSI
End If
Next

0)

'// Add a mid axis line annotation


Pego1.HorzLineAnnotation(0) = 50#
Pego1.HorzLineAnnotationAxis(0) = 2
Pego1.HorzLineAnnotationType(0) = PELAT_MEDIUM_THIN_SOLID
Pego1.HorzLineAnnotationColor(0) = Pego1.PEargb(255, 198, 0,
Pego1.ShowAnnotations = True
'// Set the working axis extents
Pego1.WorkingAxis = 2
Pego1.ManualScaleControlY = PEMSC_MINMAX
Pego1.ManualMinY = 0
Pego1.ManualMaxY = 100

'////////////////////////////////////////////////////////////////
/////
'// Stochastic Oscillator //
'///////////////////////////
Dim
Dim
Dim
Dim
Dim
Dim

SwFac As Long
Dperiod As Long
q As Long
LowMin As Single
HighMax As Single
SlowK As Single

Dim Dfactor As Single


Dim PercentD As Single
LowMin = 9999.9
HighMax = 0#
ReDim
ReDim
ReDim
ReDim

pSlowOC(nCnt + 1) As Single
pKperiod(nCnt + 1) As Single
pHigh(nCnt + 1) As Single
pLow(nCnt + 1) As Single

For pnt = 0 To nCnt - 1


pHigh(pnt) = Pego1.YData(0, pnt)
pLow(pnt) = Pego1.YData(1, pnt)
Next
'// How many days do you want to check
Days = 30
SwFac = 1
Dperiod = 15
For pnt = 0 To (nCnt - Days - 1)
For i = pnt To Days + pnt - 1
If (pHigh(i) <> 0) Then
If (pHigh(i) > HighMax) Then HighMax = pHigh(i)
End If
Next
For i = pnt To Days + pnt - 1
If (pLow(i) <> 0) Then
If (pLow(i) < LowMin) Then LowMin = pLow(i)
End If
Next
If (pYD3(Int(Days - 1 + pnt)) <> 0) Then
pKperiod(pnt) = ((pYD3(Int(Days - 1 + pnt)) - LowMin)
/ (HighMax - LowMin)) * 100#
End If
LowMin = 9999.9
HighMax = 0#
Next
For pnt = 0 To nCnt - 1 - SwFac
SlowK = 0
For q = pnt To SwFac + pnt - 1
SlowK = pKperiod(q) + SlowK
Next
pSlowOC(pnt) = SlowK / SwFac
Pego1.YData(9, Days + pnt + SwFac) = pSlowOC(pnt)
Next
For pnt = 0 To nCnt - 1 - Dperiod
PercentD = 0
For q = pnt To Dperiod + pnt - 1

PercentD = pSlowOC(q) + PercentD


Next
Dfactor = PercentD / Dperiod
Pego1.YData(10, Days + pnt + Dperiod) = Dfactor
Next
'// Set the working axis extents
Pego1.WorkingAxis = 3
Pego1.ManualScaleControlY = PEMSC_MINMAX
Pego1.ManualMinY = 0
Pego1.ManualMaxY = 100
Pego1.RenderEngine = PERE_DIRECT2D
Pego1.AntiAliasGraphics = True
Pego1.AntiAliasText = True
End Sub

You might also like