ScaleBar Object

The ScaleBar object contains the properties for an individual scale bar. Scale bars are used to graphically represent distance and scale in the form of a legend on the map.

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

The following table provides the properties of the ScaleBar object:

Property

Description

Axis

Returns/sets the axis that this scale is linked to.

CycleSpacing

Returns/sets the spacing between cycles in map units.

LabelAbove

Returns/sets the show labels above the scale bar state.

LabelFont

Returns the label font format object. It is a read-only property.

LabelFormat

Returns the label format object. It is a read-only property.

LabelIncrement

Returns/sets the amount to increment each label by (arbitrary units).

LabelOffset

Returns/sets the axis or scale label offset from the axis in page units. Returns a double.

LabelMapUnits

Returns the label map units. This is a read-only property.

LabelRotation

Returns/sets the label rotation angle in degrees.

LabelScaleUnits

Returns/sets the label scale units. The SrfLinearUnits enumeration can be used for this parameter.

Line

Returns the line format object. It is a read-only property.

NumCycles

Returns/sets the number of cycles.

NumSubDiv

Returns/sets the number of subdivisions in the first cycle.

ScaleHeight

Optional; returns/sets the height of the scale bar in page units.

ShowSubDiv

Returns/sets the show subdivisions state.

Style

Returns/sets the scale bar style.

Title

Returns/sets the scale bar title

TitleAbove

Returns/sets the show title above the scale bar state.

TitleFont

Optional; returns the FontFormat object for the title text. This is a read-only property.

TitleOffset

Optional; returns/sets the label offset in page units between the title, scale bar, and labels.

Example

The following script demonstrates how the ScaleBar object is used in reference to the ScaleBars collection.

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 contour map and assigns the map coordinate system to the

'variable named "MapFrame"

Set MapFrame = Shapes.AddContourMap(GridFileName:=SurferApp.Path+"\Samples\demogrid.grd"

 

'Declares ScaleBars as an object

Dim ScaleBars As Object

 

'Assigns the ScaleBars collection to the variable named "ScaleBars"

Set ScaleBars = MapFrame.ScaleBars

 

'Declares ScaleBar as an object

Dim ScaleBar As Object

 

'Creates a scale bar and assigns it to the variable named "ScaleBar"

Set ScaleBar = ScaleBars.Add

 

End Sub