VectorLegend Object
The VectorLegend object contains the properties for a vector map legend.
Derived from: Legend object(All methods and properties of Legend apply to this object.)
The following table provides the properties of the VectorLegend object:
Property |
Description |
Returns the name of the layer represented in the legend |
|
Returns the vector legend layout style. It is a read-only property. |
|
Returns/sets the reference vector magnitudes. |
|
Sets/returns the gap distance between samples in page units. |
The following table provides the methods of the VectorLegend object:
Method |
Description |
SetMagnitudesToLimits | Sets the vector magnitudes to the limits in the data set. |
Remarks
Assign the vector legend to a variable to access the legend properties and methods. For example,
Set VectorLegend = VectorLayer.Legend
An error will be returned if you try to access the legend properties without assigning the legend object to a variable. For example,
VectorLayer.Legend.FrameFill.Pattern = "Solid"
will result in an ActiveX Automation error. While,
Set VectorLegend = VectorLayer.Legend
VectorLegend.FrameFill.Pattern = "Solid"
will proceed as expected.
Example
The following script demonstrates how the VectorLegend object is used in reference to the VectorLayer object.
Sub Main
'Declares SurferApp as an object
Dim SurferApp As Object
'Creates an instance of the Surfer Application object and assigns it
'to the variable named "SurferApp"
Set SurferApp = CreateObject("Surfer.Application")
'Makes Surfer visible
SurferApp.Visible = True
'Declares Plot as an object
Dim Plot As Object
'Creates a plot document in Surfer and assigns it to the variable
'named "Plot"
Set Plot = SurferApp.Documents.Add(srfDocPlot)
'Declares Shapes as an object
Dim Shapes As Object
'Assigns the Shapes collection to the variable named "Shapes"
Set Shapes = Plot.Shapes
'Declares MapFrame as an object
Dim MapFrame As Object
'Creates a vector map and assigns the map coordinate system to the
'variable named "MapFrame"
Set MapFrame = Shapes.AddVectorMap(GridFileName1:=SurferApp.Path+"\Samples\demogrid.grd")
'Declares VectorLayer as an object
Dim VectorLayer As Object
'Assigns the vector map properties to the variable named "VectorLayer"
Set VectorLayer = MapFrame.Overlays(1)
'Displays the vector map legend
VectorLayer.ShowLegend = True
'Declares VectorLegend as an object
Dim VectorLegend As Object
'Assigns the vector map legend properties to the variable named
'"VectorLegend"
Set VectorLegend = VectorLayer.Legend
End Sub