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 |
Returns/sets the axis that this scale is linked to. |
|
Returns/sets the spacing between cycles in map units. |
|
Returns/sets the show labels above the scale bar state. |
|
Returns the label font format object. It is a read-only property. |
|
Returns the label format object. It is a read-only property. |
|
Returns/sets the amount to increment each label by (arbitrary units). |
|
Returns/sets the axis or scale label offset from the axis in page units. Returns a double. |
|
Returns the label map units. This is a read-only property. |
|
Returns/sets the label rotation angle in degrees. |
|
Returns/sets the label scale units. The SrfLinearUnits enumeration can be used for this parameter. |
|
Returns the line format object. It is a read-only property. |
|
Returns/sets the number of cycles. |
|
Returns/sets the number of subdivisions in the first cycle. |
|
Optional; returns/sets the height of the scale bar in page units. |
|
Returns/sets the show subdivisions state. |
|
Returns/sets the scale bar style. |
|
Returns/sets the scale bar title |
|
Returns/sets the show title above the scale bar state. |
|
Optional; returns the FontFormat object for the title text. This is a read-only property. |
|
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