<< Click to Display Table of Contents >>

 

new sg.renderers.ClassBreaksRenderer(defaultSymbol, attributeField)

 

 

Description

Create a ClassBreaksRenderer object.

 

Position

Randerer.js

 

 

Parameters

 

Parameter

Type

Description

defaultSymbol

sg.symbols.Symbol

Default symbol.

attributeField

String | function

An attribute field renderer which matches certain values.

 

 

Properties

 

Properties

Type

Description

attributeField

String

Attribute field renderer uses to match values.

colorInfo

Object

An info object that defines the color.

Name

Type

Description

minValue

Number

Minimum data value.

maxValue

Number

Maximum data value.

field

String

Name of the feature attribute field that contains the data value.

colors

Array.<sg.Color>

An array of colors defining the color ramp.

defaultSymbol

sg.symbols.Symbol

Default symbol used when a value or break cannot be matched.

infos

Array.<Object>

Each element in the array is an object that provides information about the class breaks associated with the renderer.

OpacityInfo

Object

An info object that defines the opacity.

Name

Type

Description

minValue

Number

Minimum data value

maxValue

Number

Maximum data value.

field

String

Name of the feature attribute field that contains the data value.

opacityValues

Array.<Number>

An array of opacity values.

rotationInfo

Object

An info object that defines the rotation.

Name

Type

Description

type

String

Defines the origin and direction of rotation depending on how the angle of rotation was measured.

geographic : rotates the symbol from the north in a clockwise direction.

arithmetic : rotates the symbol from the east in a counter-clockwise direction.

The default value is "geographic".

field

String

Name of the feature attribute field that contains the angle of rotation.

sizeInfo

Object

An info object that defines the size.

Name

Type

Description

minSize

Number

The smallest marker size to use.

maxSize

Number

The largest marker size to use.

field

String

Name of the feature attribute field that contains the data value.

 

 

Methods

 

Method

Type

Description

addBreak(brk)

None

Add a class break.

Name

Type

Description

minValue

Number

The minimum value

maxValue

Number

The maximum value

symbol

sg.symbols. Symbol

The symbol used to display the value

removeBreak(brk)

None

Remove a class break.

Name

Type

Description

minValue

Number

The minimum value

maxValue

Number

The maximum value

symbol

sg.symbols. Symbol

The symbol used to display the value

getColor(graphic)

graphic:sg.Graphic

Returns:Number

Return graphic color.

Name

Type

Description

graphic

sg.Graphic

Graphic to get color from.

Returns:

Type

Description

sg.Color

The color of the graphic

getRotationAngle(graphic)

graphic:sg.Graphic

Returns:Number

Return graphic rotation angle in degrees.

Name

Type

Description

graphic

sg.Graphic

An input graphic for which you want to get the angle of rotation.

Returns:

Type

Description

Number

The angle of the rotation

getSize(graphic)

graphic:sg.Graphic

Returns:Number

Return graphic symbol size in pixels.

Name

Type

Description

graphic

sg.Graphic

The graphic for which you want to calculate the symbol size.

Returns:

Type

Description

Number

The size of the graphic.

setColorInfo(info)

graphic:sg.Graphic

Returns:sg.symbols.Symbol

Define the colorInfo.

Name

Type

Description

info

Object

An info object that defines the color.

setRotationInfo(info)

Object

Define rotation angle for the renderer.

Name

Type

Description

info

Object

An info object that defines the angle of the rotation.

getOpacity(graphic)

graphic:sg.Graphic

Returns:Number

return symbol transparency

Name

Type

Description

graphic

sg.Graphic

Graphic to get the opacity from.

Returns:

Type

Description

Number

The opacity of the graphic

setOpacityInfo(info)

Object

Define symbol transparency

Name

Type

Description

info

Object

An info object that defines the opacity.

setSizeInfo(info)

Object

Define symbol size

Name

Type

Description

info

Object

An info object that defines the size.

toXml()

Returns:

String

convert to XML string

Returns:

Type

Description

String

Convert to XML representation.

 

 

Example

 

 

<script type="text/javascript" src="scripts/GraphicsLayer.js"></script>

<script type="text/javascript" src="scripts/Renderer.js"></script>

<script type="text/javascript" src="scripts/Symbol.js"></script>

<script type="text/javascript" src="scripts/Graphic.js"></script>

 

var classBreaksRenderer = new sg.renderers.ClassBreaksRenderer(simpleFillSymbol, "value");

classBreaksRenderer.addBreak({

       minValue: 0,

       maxValue: 300,

       symbol: new sg.symbols.SimpleMarkerSymbol(sg.symbols.SimpleMarkerSymbol.STYLE_SOLID, 16, outline, sg.Color(200, 255, 200, 1));

       });

 

classBreaksRenderer.addBreak({

       minValue: 301,

       maxValue: 450,

       symbol: new sg.symbols.SimpleMarkerSymbol(sg.symbols.SimpleMarkerSymbol.STYLE_SOLID, 16, outline, sg.Color(255, 255, 200, 1));

       });

 

classBreaksRenderer.addBreak({

       minValue: 451,

       maxValue: Infinity,

       symbol: new sg.symbols.SimpleMarkerSymbol(sg.symbols.SimpleMarkerSymbol.STYLE_SOLID, 16, outline, sg.Color(255, 200, 200, 1));

       });

 

 

 

See live demo

 

 


©2015 Supergeo Technologies Inc.