DiscreteColorScale Object

The DiscreteColorScale object represents a discrete color scale legend. Discrete color scales represent classed data with a single color value. For example, the range 1.0 to 10.0 might be assigned to red, 10.0 to 20.0 to green, etc. This object coincides with the contour map or wireframecolor scale bar.

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

The following table provides the properties of the DiscreteColorScale object:

Property

Description

FirstLabel

Returns/sets the index of the first label.

FrameLine

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

LabelAngle

Returns/sets the label angle in degrees.

LabelFont

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

LabelFormat

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

LabelFrequency

Returns/sets the label frequency.

Opacity

Returns/sets the opacity.

Example 1

The following script demonstrates how the DiscreteColorScale object is used in reference to the ContourLayer 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 contour map and assigns the map coordinate system to

'the variable named "MapFrame"

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

 

'Declares ContourLayer as an object

Dim ContourLayer As Object

 

'Assigns the contour map properties to the variable named

'"ContourLayer"

Set ContourLayer = MapFrame.Overlays(1)

 

'Displays the contour map color scale

ContourLayer.ShowColorScale = True

 

'Declares DiscreteColorScale as an object

Dim DiscreteColorScale As Object

 

'Assigns the color scale properties to the variable named

'DiscreteColorScale"

Set DiscreteColorScale = ContourLayer.ColorScale

 

End Sub

Example 2

The following script demonstrates how the ContinuousColorScale object is used in reference to the Wireframe 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 wireframe and assigns the map coordinate system to

'the variable named "MapFrame"

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

 

'Declares Wireframe as an object

Dim Wireframe As Object

 

'Assigns the wireframe properties to the variable named

'"Wireframe"

Set Wireframe = MapFrame.Overlays(1)

 

'Displays the wireframe map color scale

Wireframe.ShowColorScale = True

 

'Declares DiscreteColorScale as an object

Dim DiscreteColorScale As Object

 

'Assigns the color scale properties to the variable named

'"DiscreteColorScale"

Set DiscreteColorScale = Wireframe.ColorScale

 

End Sub