-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodSettings.vb
73 lines (49 loc) · 2.23 KB
/
modSettings.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Module modSettings
'Public variables used in graph construction and scaling -
'scaleFactorX- scale multiplying coefficient used to draw new value diapason on X-axis:
Public scaleFactorX As Single
'scaleFactorY - scale multiplying coefficient used to draw new value diapason on Y-axis:
Public scaleFactorY As Single
'Distance from the borders of the graph in twips:
Public BORDER_SPACE As Single
'Variables to be used in calculations drawing the coordinates and graph:
Public Xmin As Single
Public Ymin As Single
Public Xmax As Single
Public Ymax As Single
Public betweenMarkersX As Single
Public betweenMarkersY As Single
Public Graph As GraphObject
'Definition of main structure "GraphObject" (this is similar to structure in C language):
Structure GraphObject
Dim MinX As Single 'Minimum X-value
Dim MaxX As Single 'Maximum X-value
Dim MinY As Single 'Minimum Y-value
Dim MaxY As Single 'Maximum Y-value
Dim AxisColor As Short 'Color of the axis
Dim EqualScaleXY As Boolean '=True, for x- and y-axis to have the same distance between markers
End Structure
Function XinPoints(ByRef x As Single) As Single
'Get "XinPoints" value of a given X coordinate:
XinPoints = BORDER_SPACE + (-Xmin * betweenMarkersX) + (x * betweenMarkersX)
End Function
Function YinPoints(ByRef y As Single) As Single
'Get "YinPoints" value of a given Y coordinate:
YinPoints = BORDER_SPACE + (-Ymin * betweenMarkersY) + (y * betweenMarkersY)
End Function
'Subroutine to set initial parameters for a graph:
Sub SetGraphParameters(ByRef initialGraph As GraphObject)
'"With" statement allows you to perform a series of statements on a specified object
' without requalifying the name of the object,
' for example, to change a number of different properties on a single object:
With initialGraph
'Set initial value for Y-axis scale coefficient:
scaleFactorY = 1
'Set scales (X-Y minimum and maximum values).
.MinX = 0
.MaxX = 20
.MinY = -6
.MaxY = 14
End With
End Sub
End Module