Macro (SVB) Programs Example - Graph Function Library

Included in the Examples - Macro - Graph Examples directory of Statistica is a graph function library file named GraphLib.svx. This library contains a powerful array of functions for customizing 2D and 3D graphs. To include this library file into a new macro application, simply use the '#USES directive in the declaration section of the macro along with the fully qualified file path to GraphLib.svx. For example, if GraphLib.svx is located on your computer at "C:\Program Files\Dell\Statistica 13\Examples\Macros\Graph Examples\GraphLib.svx", your new macro should look like this:

'#USES "C:\Program Files\Dell\Statistica 130\Examples\Macros\Graph Examples\GraphLib.svx"

Sub Main

End Sub

GraphLib.svx contains the following functions:

 

Name

Parameters

Description

SetGraphOuterBkgroundColor

g As Graph,
Color As Long

Sets the outer background color of the specified graph.

SetGraphInnerBkgroundColor

g As Graph,
Color As Long

Sets the inner background color of the specified graph.

SetGraphTitle

g As Graph,
MyTitle As String,
FontName As String,
FontSize As Integer

Sets the title color of the specified graph. The parameters FontName and FontSize default to Arial and 10, respectively.

SetGraphGridLinesVisible

g As Graph,
MakeVisible As Boolean

Toggles the visibility of the specified graph's gridlines. The MakeVisible parameter defaults to True.

SetGraphAxisStepSize

g As Graph,
WhichAxis As AxisType,
StepSize As Double

Sets the step size of the specified axis of the specified graph.

SetGraphAxisFormat

g As Graph,
WhichAxis As AxisType,
Format As String

Sets the axis format of the specified axis of the specified graph.

SetGraphAxisScaleRange

g As Graph
WhichAxis As AxisType,
xmin As Double,
xmax As Double,
xstep As Double

Sets the axis scaling of the specified axis of the specified graph.  If the xstep parameter is left blank, then the current axis step size will persist.

SetGraphAxisScaleOrientation

g As Graph,
WhichAxis As AxisType,
WhichOrientation As AxisScalingStyle

Sets the axis scale orientation of the specified axis of the specified graph.

SetGraphTickmarkOrientation

g As Graph,
WhichAxis As AxisType,
TickOrientation As TickMarkOrientation 

Sets the tick mark style of the major units of the specified axis of the specified graph.

SetGraphAxisLayout

g As Graph,
WhichAxis As AxisType,

AxisPos As AxisLayout

Sets the axis layout of the specified axis of the specified graph.

SetGraphAxisLineColor

g As Graph,
WhichAxis As AxisType,
Color As Long

Sets the line color of the specified axis of the specified graph.

SetGraphAllAxesLineColor

g As Graph,
WhichAxis As AxisType,
Color As Long

Sets the same line color to all axes of the specified graph.

AddCustomScaleValue

g As Graph,
WhichAxis As AxisType,
ScaleValue As Double,
ScaleLabel As String,
DisplayValue As Boolean,
DisplayGrid As Boolean,
DisplayTickMark As Boolean

Adds a custom axis label to the specified axis of the specified graph. The parameters DisplayValue, DisplayGrid, and DisplayTickMark all default to False.

SetGraphPointLabelsVisible

g As Graph,
WhichPlot As Integer,

MakeVisible As Boolean

Toggles the visibility of the specified plot's point labels. The MakeVisible parameter defaults to True.

SetGraphPointLabelsType

g As Graph,
WhichPlot As Integer,

PointLabel As PointLabelType

Sets the point labels type of the specified plot.

AddGraphCustomText

g As Graph,
TextString As String,
x As Double,
y As Double,
FontName As String,
FontSize As Long

Adds a custom text object to the specified graph. The parameters FontName and FontSize default to Arial and 10, respectively. Also, the x and y coordinate parameters are (0,0) by default.

EmbedGraphFile

GraphFilePath As String,
TargetGraph As Graph

Embeds the specified graph file into the specified graph.

SetGraphWindowSize

g As Graph,
GraphWidth As Double,
GraphHeight As Double

Sets the window size of the specified graph.

GraphZoom

g As Graph,
XMin As Double,
XMax As Double,
YMin As Double,
YMax As Double

Zooms into the specified graph.

GraphSpin

g As Graph,
XCoordinate As Double,
YCoordinate As Double,
ZCoordinate As Double

Spins of the specified graph. Note that this only applies to 3D graphs.

IsGraph2D

g As Graph

Verifies if the specified graph is 2 dimensional.

IsGraph3D

g As Graph

Verifies if the specified graph is 3 dimensional.

SetGraphCoordinateSystem

g As Graph,
CoSys As AxisCoordinateSystem

Sets the coordinate system of the specified graph.

AddGraph2DFunction

g As Graph,
Function2DText As String

Adds a 2D function to the specified graph.

RemoveAllGraphFunctions

g As Graph

Removes all functions from the specified graph.

AddGraphFitLine

g As Graph,
WhichPlot As Long,

FitLine As FitLineType

Adds a fit line to the specified graph.

SetGraphFitLineColor

g As Graph,
WhichPlot As Long,

WhichFitLine As Long,
Color As Long

Sets the color of the specified plot's fit line of the specified graph.

SetGraphFitLineWidth

g As Graph,
WhichPlot As Long,

WhichFitLine As Long,
LineWidth As Double

Sets the width of the specified plot's fit line of the specified graph.

SetGraphFont

g As Graph,
FontSize As Double
FontFaceName As String,
Color As Long

Sets the font for all titles, legends, axes, and point labels of the specified graph. The parameters FontName and FontSize default to Arial and 10, respectively. Also, the parameter Color defaults to black.

SetGraphAreaColor

g As Graph,
WhichPlot As Integer,
ForeColor As Long,
BackColor As Long

Sets the foreground and background colors of the plot's of the specified.

Note that there are numerous enumerations that can be used as arguments for these functions. Below are the enumerations that pertain to the parameters of these graph functions:
 

Enumeration name

Values that may be passed as arguments for the enumeration

AxisType

scgX
scgY
scgTopAxis
scgLYAxis

scgRYAxis
scgV
scgZ

TickMarkOrientation

Inside
Outside
Crossed

PointLabelType

XValue
YValue
TextLabels

ScaleOrientation

Auto
Parallel
Perpendicular
Alternate

AxisLayout

StandardLayout
ReversedLayout

AxisCoordinateSystem

StandardSystem
PolarSystem

FitLineType

Linear2D
Polynomial2D
Logarithmic2D
Exponential2D
DistWeightedLS2D
NegExpWeightedLS2D
Spline2D
Lowess2D
HistogramNormal
HistogramBeta
HistogramExponential
HistogramExtreme
HistogramGamma
HistogramGeometric
HistogramLaplace
HistogramLogistic
HistogramLognormal
HistogramPoisson
HistogramRayleigh
HistogramWeibull
Linear3D
Quadratic3D
DistWeightedLS3D
NegExpWeightedLS3D
Spline3D
TernaryLinear
TernaryQuadratic
TernaryFullCubic
TernarySpecialCubic