LabelFormat Object

The LabelFormat object contains the properties of text labels such as the numeric format and the number of decimal digits.

The following table provides all properties of the LabelFormat object.

Property

Description

AbsoluteValue

Returns/sets the absolute value style.

Application

Returns the application object. It is a read-only property.

DateTimeFormat

Returns/sets the label date/time format string.

DMSFormat

Returns/sets the label DMS format.

EmbedSpace

Returns/sets the flag indicating whether labels should add spaces after each DMS symbol/before hemisphere suffix.

NumDigits

Returns/sets the number of digits to the right of the decimal point.

Parent

Returns the parent object. It is a read only property.

Postfix

Returns/sets the label postfix string.

Prefix

Returns/sets the label prefix string.

SuppressLeadingZeros

Returns/sets the flag indicating whether labels should remove leading zeros.

SuppressTrailingZeros

Returns/sets the flag indicating whether labels should remove trailing zeros.

Thousands

Returns/sets the thousands style.

TrimExponent

Returns/sets the trim exponent style.

Type

Returns/sets the label format type.

UseSymbols

Returns/sets the flag indicating whether labels should use symbols.

Example 1

The following script demonstrates how the LabelFormat object is used in reference to the Axis 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 map and assigns it to the variable named "MapFrame"

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

 

'Declares Axes as an object

Dim Axes As Object

 

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

Set Axes = MapFrame.Axes

 

'Declares Axis as an object

Dim Axis As Object

 

'Assigns the Bottom Axis to the variable named "Axis"

Set Axis = Axes(1)

 

'Declares LabelFormat as an object

Dim LabelFormat As Object

 

'Assigns the label properties of the axis to the variable named

'"LabelFormat"

Set LabelFormat = Axis.LabelFormat

 

End Sub

Example 2

This example demonstrates how to set DMS-specific properties for labels.

Sub Main

 

Dim Surfer As Object

 

Set Surfer = GetObject(, "Surfer.Application")

Set Doc = Surfer.Documents.Add

Set Map = Doc.Shapes.AddContourMap(Surfer.Path + "\Samples\Colorado.grd")

Set LabelFormat = Map.Axes.Item(1).LabelFormat

 

'set up some properties

LabelFormat.Type = srfLabDMS

LabelFormat.NumDigits = 3

 

'set DMSFormat to 'd_dd_E' or ('d.dd E' in the UI)

LabelFormat.DMSFormat = "d_dd_E"

 

'disable the usage of symbols for labels using this LabelFormat

LabelFormat.UseSymbols = False

 

'disable the adding of spaces after each DMS symbol/before hemisphere suffix for labels using this LabelFormat

LabelFormat.EmbedSpace = False

 

'enable the removal of leading zeros for all labels using this LabelFormat

LabelFormat.SuppressLeadingZeros = True

 

'disable the removal of trailing zeros for all labels using this LabelFormat

LabelFormat.SuppressTrailingZeros = False

 

End Sub