Class: graphThemeLayer

L.supermap.graphThemeLayer

The GraphThemeLayer class.

L.supermap.graphThemeLayer(name, chartsType, options)

GraphThemeLayer.js, line 7

The graph thematic map draws charts for each element to reflect the corresponding thematic value. It can express multiple field attribute information, and form a horizontal and vertical contrast between the region itself and different regions. Graph thematic maps are usually used to show demographic information, for example, GDP, Crop product, and population of each state. Currently it provides a statistical chart type: bar, line, pie, bar3D, point, and ring.

Name Type Description
name string

The name for the layer.

chartsType string

Chart type, required, currently supports: "Bar", "Bar3D", "Line", "Point", "Pie", "Ring".

options Object

The graph themeLayer parameters.

Name Type Default Description
chartsSetting Object

For the settable properties of the chartsSetting object of each type of chart, please refer to the description of the attributes of the chartsSetting object in the comments of the specific chart model class. The chartsSetting object usually has the following five basic settable properties.

Name Type Description
width number

Width of the theme elements(chart).

height number

Height of the theme elements(chart).

codomain Array.<number>

Domain, an array with the length of 2, the first one is the minimum, the second one is the maximum value.

XOffset number optional

Offset in X direction of the theme elements(chart), the unit is pixel.

YOffset number optional

Offset in Y direction of the theme elements(chart), the unit is pixel.

dataViewBoxParameter Array.<number> optional

The data view frame dataViewBox parameters, means four inner offset values in left, down, right, up direction of chartBox( constituted by chart position, chart width, chart height), an array with the length of 4.

decimalNumber number optional

The decimal value of the data value array dataValues, decimal processing parameters, the range is: [0, 16]. If you do not set this parameter, the decimal will not be processed.

themeFields string

Specifies to create a thematic map field.

isOverLay boolean true optional

Whether to process the overlap. If set to true, it will hide the ones which have been overlapped. For example: it has drawn a diagram A, and then is ready to draw a diagram B, the overlap processing program will first check whether B is overlapped with A, only when B and A are completely disjointed, chart B will be drawn.

alwaysMapCRS boolean false optional

Whether the feature coordinates are consistent with the map coordinate system, and the feature defaults to the latitude and longitude coordinates.

cache Object optional

cache.

charts Object optional

charts.

id string optional

Theme layer ID。The theme layer ID is created by default using CommonUtil.createUniqueID("themeLayer_").

opacity number 1 optional

Layer transparency.

TFEvents Array optional

Thematic feature events are temporarily stored.

attribution string 'Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>' optional

Copyright information.

Extends

Events

inherited changelayer

ThemeLayer.js, line 509

Fires after the layer property changes.

Properties:
Name Type Description
layer Object

Layer.

property string

Layer properties.

inherited featuresremoved

ThemeLayer.js, line 204

Triggered after the deleted feature succeeds.

Properties:
Name Type Description
features Array.<SuperMap.Feature.Vector>

Event object.

succeed boolean

To delete whether the deletion is successful, true is the deletion succeeds, false is the deletion failure.

Methods

inherited addFeatures(features)

ThemeLayer.js, line 118

Add data to the thematic map. It supports the following type of the feature: the feature object in json format returned from iServer or the L.supermap.themeFeature

Name Type Description
features SuperMap.ServerFeature | L.supermap.themeFeature | GeoJSONObject

The feature to be added.

inherited destroyFeatures(features)

ThemeLayer.js, line 136

Destroy features.

Name Type Description
features Array.<SuperMap.Feature.Vector>

Features to be destroy.

inherited getEvents(){Object}

ThemeLayer.js, line 50

Get the event of the layer.

Returns:
Type Description
Object Return the event supported by the layer.

inherited getFeatureBy(property, value)

ThemeLayer.js, line 241

Ergodic every feature of the features array in the thematic map. If feature[property] === value, return this feature (and only return the first one).

Name Type Description
property string

The property name of the feature.

value string

The value corresponding to property.

inherited getFeatureById(featureId)

ThemeLayer.js, line 261

Return the corresponding vector features by the specified id. If it does not exist, return to null.

Name Type Description
featureId number

The id property of the vector feature.

inherited getFeatures(){Array}

ThemeLayer.js, line 226

Get valid features in the current layer.

Returns:
Type Description
Array Return valid features in the layer.

inherited getFeaturesByAttribute(attrName, attrValue){Array}

ThemeLayer.js, line 270

Retucrn an array contains all the matched features by giving a key and a value of a an attribute.

Name Type Description
attrName string

The key name of the attribute.

attrValue string

The value of the attribute.

Returns:
Type Description
Array Return all the matched feature arrays.

inherited getLocalXY(coordinate)

ThemeLayer.js, line 407

Convert the Geographic coordinates to Pixel coordinates.

Name Type Description
coordinate Array

The coordinate object.

inherited off(event, callback, context)

ThemeLayer.js, line 375

Remove event listeners from the thematic features

Name Type Description
event Event

The event listener.

callback function

The callback.

context string

The context,

inherited on(event, callback, context)

ThemeLayer.js, line 359

Add event listeners on the thematic features.

Name Type Description
event Event

The event listener.

callback function

The callback.

context string

The context.

inherited onRemove(map)

ThemeLayer.js, line 68

Remove the map.

Name Type Description
map L.Map

The map to be removed.

inherited redraw(){boolean}

ThemeLayer.js, line 341

Redraw this layer

Returns:
Type Description
boolean Whether redraw success or not.

inherited redrawThematicFeatures(bounds)

ThemeLayer.js, line 127

Redraw thematic features. It is an abstract function. This method should be implemented by instantiable subclasses

Name Type Description
bounds L.bounds

The bounds of redrawing the thematic feature.

inherited removeAllFeatures()

ThemeLayer.js, line 213

Remove all vector features on the current layer.

inherited removeFeatures(features)

ThemeLayer.js, line 154

Remove features from the thematic layer. This function removes all vector features (data) passed in.

Name Type Description
features Array.<SuperMap.Feature.Vector>

The features array to be removed.

inherited setOpacity(opacity)

ThemeLayer.js, line 325

Set opacity of the layer. The value is between 0 and 1.

Name Type Description
opacity number

The opacity.

inherited toFeature(features){SuperMap.Feature.Vector}

ThemeLayer.js, line 467

Convert to the iClient features, this method will be deprecated and replaced by L.supermap.ThemeLayer#toiClientFeature.

Name Type Description
features SuperMap.ServerFeature | L.supermap.themeFeature | GeoJSONObject

The pending features include the L.supermap.ThemeFeature type and the GeoJOSN specification data type.

Deprecated
  • Yes
Returns:
Type Description
SuperMap.Feature.Vector The converted iClient features.

inherited toiClientFeature(features){Array.<SuperMap.Feature.Vector>}

ThemeLayer.js, line 432

Convert to the iClient features.

Name Type Description
features SuperMap.ServerFeature | L.supermap.themeFeature | GeoJSONObject

The pending features include the L.supermap.ThemeFeature type and the GeoJOSN specification data type.

Returns:
Type Description
Array.<SuperMap.Feature.Vector> The converted iClient features.

inherited update(bounds)

ThemeLayer.js, line 290

Update the layer.

Name Type Description
bounds L.bounds

Bounds of the layer.