Professional Documents
Culture Documents
Form 2
Form 2
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
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
"
"
"
"
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
Then
=
=
=
=
=
=
"
"
"
"
"
"
"
"
"
"
"
"
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
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
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
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. //
=
=
=
=
"Texas"
"Florida"
"Washington"
"California"
=
=
=
=
Pego1.PEargb(128,
Pego1.PEargb(128,
Pego1.PEargb(128,
Pego1.PEargb(128,
=
=
=
=
=
=
=
=
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
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
Pego1.ManualScaleControlY = PEMSC_MINMAX
Pego1.ManualMinY = 0#
Pego1.ManualMaxY = 1500#
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
*****'
'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
'
'
'
'
'
'// 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)
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(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
'
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
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
0)
1)
2)
3)
=
=
=
=
0
0
0
0
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
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
//
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
=
=
=
=
Pego1.PEargb(228,
Pego1.PEargb(228,
Pego1.PEargb(228,
Pego1.PEargb(228,
198, 0, 0)
0, 198, 198)
198, 138, 0)
0, 198, 0)
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.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
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)
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) *
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
7
7
7
7
7
7
7
7
0)
If c > 5 Then
Pego1.TAColor(r, c) = Pego1.PEargb(255, 0, 148,
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
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
=
=
=
=
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
'****************************************************************
*****'
'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
=
=
=
=
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
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
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
'///////////////////////
'
'
'// 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
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
Rnd)
Pego1.SubsetObstacles(0)
Pego1.SubsetObstacles(1)
Pego1.SubsetObstacles(2)
Pego1.SubsetObstacles(3)
=
=
=
=
False
True
True
True
=
=
=
=
"Texas"
"Florida"
"Washington"
"California"
=
=
=
=
Pego1.PEargb(255,
Pego1.PEargb(255,
Pego1.PEargb(255,
Pego1.PEargb(255,
=
=
=
=
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
PELT_MEDIUMSOLID
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
p))
'
'
'// 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
*****'
'****************************************************************
*****'
'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
to True, and
'//! TALocation set to InsidePixelUnits.
dragging table.
text //
= "Subset "
= Pego1.SubsetLabels(0)
= Pego1.SubsetLabels(1)
= Pego1.SubsetLabels(2)
= Pego1.SubsetLabels(3)
= "Visible? "
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
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
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.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
'
'
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
=
=
=
=
=
=
=
=
=
=
"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,
=
=
=
=
=
=
=
=
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)
1)
'////////////////////////////////////////////////////////////////
//'
'////////////////////////////////////////////////////////////////
//'
'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
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))
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
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
0)
'////////////////////////////////////////////////////////////////
/////
'// 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
pSlowOC(nCnt + 1) As Single
pKperiod(nCnt + 1) As Single
pHigh(nCnt + 1) As Single
pLow(nCnt + 1) As Single