PostLegend Object

The PostLegend object contains the properties for the legend in the post map and classed post map.

Derived from: Legend object (All methods and properties of Legend apply to this object.)

The following table provides the properties of the PostLegend object:

Property

Description

LayerName

Returns the name of the layer represented in the legend.

ReverseOrder

Returns/sets the reverse legend item order state.

SampleCount

Returns/sets the number of samples to display for unclassed symbology.

SampleSpacing

Returns/sets the gap distance between samples in a page.

SymbolSize

Returns/sets the legend symbol size in page units.

SymbolSizeMethod

Returns/sets the legend symbol size method.

Template

Returns/sets the template used to format legend items.

VariableLayout

Sets/returns the layout arrangement for size and color variables on a normal post layer

Remarks

Assign the post legend to a variable to access the legend properties and methods. For example,

Set PostLegend = PostLayer.Legend

An error will be returned if you try to access the legend properties without assigning the legend object to a variable. For example,

PostLayer.Legend.FrameFill.Pattern = "Solid"

will result in an ActiveX Automation error. While,

Set PostLegend = PostLayer.Legend

PostLegend.FrameFill.Pattern = "Solid"

will proceed as expected.

Example

The following script demonstrates how the PostLegend object is used in reference to the ClassedPostLayer 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 classed post map and assigns the map coordinate system to the

'variable named "MapFrame"

Set MapFrame = Shapes.AddClassedPostMap(DataFileName:=SurferApp.Path+"\Samples\demogrid.dat")

 

'Declares ClassedPostLayer as an object

Dim ClassedPostLayer As Object

 

'Assigns the classed post map properties to the variable named

'"ClassedPostLayer"

Set ClassedPostLayer = MapFrame.Overlays(1)

 

'Displays the classed post map legend

ClassedPostLayer.ShowLegend = True

 

'Declares PostLegend as an object

Dim PostLegend As Object

 

'Assigns the classed post map legend properties to the variable named

'"PostLegend"

Set PostLegend = ClassedPostLayer.Legend

 

End Sub