Class: Graph

ol.source.Graph

Statistical thematic map layer base class.

new ol.source.Graph(chartsType, name, opt_options)

Graph.js, line 5
Name Type Default Description
chartsType string

Type of the charts.

name string

Name of the layer.

opt_options Object

parameters.

Name Type Default Description
map ol.Map

The map for OpenLayers.

chartsType string

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

themeFields string

Specifies to create a thematic map field.

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.

id string optional

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

opacity number 1 optional

Layer transparency.

logo string optional

Logo.

projection ol.proj.Projection optional

ol.proj.Projection Projection information.

ratio number 1.5 optional

View ratio, 1 means that the canvas is the size of the map viewport, 2 means that the canvas is twice the width and height of the map viewport, and so on. Must be 1 or higher.

resolutions Array.<number> optional

Resolution array.

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.

state ol.source.State optional

Resource status.

opt_option.attributions string | Object 'Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>' optional

Copyright information.

Extends

Methods

addFeatures(features)

Graph.js, line 73

Add data to the thematic map layer. The supported feature types are: The feature json object returned by the iServer or the L.supermap.themeFeature.

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

features to be added.

clear()

Graph.js, line 395

The contents of cleanup include data (features), thematic elements, and caching.

clearCache()

Graph.js, line 353

Clear cache.

createThematicFeature(feature)

Graph.js, line 136

Add data to the thematic map layer. The supported feature types are: The feature JSON object returned by iServer.

Name Type Description
feature Object

The feature to be added.

destroy()

Graph.js, line 47

Disposes the resource. The property that references resource is set to null.

inherited destroyFeatures(features)

Theme.js, line 139

Destroy one features.

Name Type Description
features SuperMap.Feature.Vector

The feature to be destroy.

drawCharts()

Graph.js, line 157

Draw a chart. Contains the cover treatment.

inherited fire(type, event)

Theme.js, line 337

Add thematic element event listener.

Name Type Description
type string

Type of the event.

event string

Name of the event.

inherited getFeatureBy(property, value){SuperMap.Feature.Vector}

Theme.js, line 259

Traversing each feature in the element array features of the thematic graph, When feature[property] === value, return to this feature (and return only to the first one).

Name Type Description
property string

The name of an attribute for the feature.

value string

The value corresponding to property.

Returns:
Type Description
SuperMap.Feature.Vector The first vector element that matches the attributes and values.

inherited getFeatureById(featureId){SuperMap.Feature.Vector}

Theme.js, line 279

Return to a corresponding vector elements by a specified ID.

Name Type Description
featureId string

Property ID of the vector feature.

Returns:
Type Description
SuperMap.Feature.Vector The feature corresponding to ID, if it does not exist, return to null.

inherited getFeatures(){SuperMap.Feature.Vector}

Theme.js, line 244

Look at the valid data in the current layer.

Returns:
Type Description
SuperMap.Feature.Vector The user joins the valid data of the layer.

inherited getFeaturesByAttribute(attrName, attrValue){Array.<SuperMap.Feature.Vector>}

Theme.js, line 289

By giving the key and value of an attribute, return to all the matched features.

Name Type Description
attrName string

Key of the property.

attrValue string

Property ID of the vector features.

Returns:
Type Description
Array.<SuperMap.Feature.Vector> A matching feature array.

inherited getLocalXY(coordinate)

Theme.js, line 442

Get the coordinate system.

Name Type Description
coordinate Object

Coordinate position.

getShapesByFeatureID(featureID)

Graph.js, line 255

Get all the shapes associated with feature by FeatureID. If this parameter is not passed in, the function returns all the graphs.

Name Type Description
featureID number

Feature ID.

isChartInMap(mapPxBounds, chartPxBounds)

Graph.js, line 333

Determine whether the chart is on the map.

Name Type Description
mapPxBounds SuperMap.Bounds

Map pixel range.

chartPxBounds Array.<Object>

An array of quadrilateral nodes in a chart range.

isPointInPoly(pt, poly)

Graph.js, line 318

Determine whether a point is in a polygon. (ray method)

Name Type Description
pt Object

A point object that needs to be determined, which contains the attribute x (abscissa), and the attribute y (ordinate).

poly Array.<Object>

An array of polygonal nodes.

isQuadrilateralOverLap(quadrilateral, quadrilateral2)

Graph.js, line 275

Determine whether the two quadrilateral has overlay.

Name Type Description
quadrilateral Array.<Object>

An array of quadrilateral nodes.

quadrilateral2 Array.<Object>

Second quadrilateral nodes array.

inherited on(event, callback)

Theme.js, line 319

Add thematic element event listener. The events supported include: click, mousedown, mousemove, mouseout, mouseover, mouseup.

Name Type Description
event string

Name of the event.

callback RequestCallback

event callbacks.

redraw()

Graph.js, line 382

Redraw this layer.

redrawThematicFeatures(extent)

Graph.js, line 91

Redraw all the thematic elements. This method contains all the steps to draw a thematic element, it includes the conversion of user data to thematic elements, thinning, caching, and other steps. This method is called for layer refresh when map roaming.

Name Type Description
extent Object

Redrawn range.

removeAllFeatures()

Graph.js, line 373

Remove all features.

removeFeatures(features)

Graph.js, line 362

Delete feature from the thematic diagram. This function removes all the vector elements that are passed in. Each item in the features array in the parameter must be the feature that has been added to the current layer.

Name Type Description
features SuperMap.Feature.Vector

Features to be deleted.

inherited rotate(pixelP, rotation, center)

Theme.js, line 470

Get the pixel coordinates after a pixel coordinate point pixelP revolves the rotation arc in the center of the center counterclockwise.

Name Type Description
pixelP number

Pixel coordinates point position.

rotation number

Angle of rotation.

center number

Center position.

inherited scale(pixelP, center, scaleRatio){Array.<number>}

Theme.js, line 483

Get the pixel coordinates of a pixel coordinate point pixelP is scaleRatio times larger than the center.

Name Type Description
pixelP Object

Pixel point.

center Object

Center position.

scaleRatio number

Scaling multiplier.

Returns:
Type Description
Array.<number> Return array ratio.

setChartsType(chartsType)

Graph.js, line 63

Set type of the charts. This function can dynamically change the chart type. Before calling this function, please do the related configuration for the new type of chart through chartsSetting.

Name Type Description
chartsType string

Type of the charts. Currently available: "Bar", "Bar3D", "Line", "Point", "Pie", "Ring".

inherited setOpacity(opacity)

Theme.js, line 157

Set the opacity of the layer and take the value between [0-1].

Name Type Description
opacity number

opacity.

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

Theme.js, line 539

Converted to an iClient feature, this method will be deprecated and replaced by ol.source.Theme#toiClientFeature.

Name Type Description
features ol.supermap.ThemeFeature | GeoJSONObject | ol.Feature

The pending features include the ol.supermap.ThemeFeature type, the GeoJOSN specification data type, and the ol.feature type.

Returns:
Type Description
SuperMap.Feature.Vector IClient feature after conversion.

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

Theme.js, line 497

Convert to the iClient features.

Name Type Description
features ol.supermap.ThemeFeature | GeoJSONObject | ol.Feature

The pending features include the ol.supermap.ThemeFeature type, the GeoJOSN specification data type, and the ol.feature type.

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

inherited un(event, callback)

Theme.js, line 404

Removal of thematic element event listener.

Name Type Description
event string

Name of the event.

callback RequestCallback

event callbacks.