new zondy.themelayer.GraphThemeLayer(name, chartsType, options)
统计专题图通过为每个要素绘制统计图表来反映其对应的专题值的大小。它可同时表示多个字段属性信息,在区域本身与各区域之间形成横向和纵向的对比。
统计专题图多用于具有相关数量特征的地图上,比如表示不同地区多年的粮食产量、GDP、人口等,不同时段客运量、地铁流量等。目前提供的统计图类型有:柱状图(Bar),折线图(Line),饼图(Pie),三维柱状图(Bar3D),点状图(Point),环状图(Ring)。
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
string |
专题图表名称。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
chartsType |
string |
图表类型。目前可用:"Bar","Bar3D","Line","Point","Pie","Ring"。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
待设置的参数。
|
Extends
Events
-
beforefeaturesadded
document/theme/GraphThemeLayer.js, line 79 -
向专题图图层中添加数据之前触发。
Properties:
Name Type Description featuresL.features 待添加的要素。
-
inherited changelayer
document/theme/ThemeLayer.js, line 485 -
图层属性改变之后触发。
Properties:
Name Type Description layerObject 图层。
propertystring 图层属性。
-
inherited featuresremoved
document/theme/ThemeLayer.js, line 193 -
删除的要素成功之后触发。
Properties:
Name Type Description featuresArray.<zondy.Feature.Vector> 事件对象。
succeedboolean 要输是否删除成功,true 为删除成功,false 为删除失败。
Methods
-
addFeatures(features)
document/theme/GraphThemeLayer.js, line 72 -
向专题图图层中添加数据。
Name Type Description featuresL.features 待添加的要素。
-
clear()
document/theme/GraphThemeLayer.js, line 502 -
清除图层。清除的内容包括数据(features) 、专题要素、缓存。
-
clearCache(mapPxBounds, chartPxBounds)
document/theme/GraphThemeLayer.js, line 446 -
判断图表是否大小合适,超过地图范围的1/4的不绘制。
Name Type Description mapPxBoundszondy.Bounds 地图像素范围。
chartPxBoundsArray.<Object> 图表范围的四边形节点数组。
例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。 -
clearCache()
document/theme/GraphThemeLayer.js, line 461 -
清除缓存数据。
-
createThematicFeature(feature)
document/theme/GraphThemeLayer.js, line 165 -
创建专题要素(图表)。
Name Type Description featurezondy.Feature 待创建的要素。
-
inherited destroyFeatures(features)
document/theme/ThemeLayer.js, line 125 -
销毁要素。
Name Type Description featuresArray.<zondy.Feature.Vector> 将被销毁的要素。
-
drawCharts()
document/theme/GraphThemeLayer.js, line 194 -
绘制图表。包含压盖处理。
-
inherited getEvents(){Object}
document/theme/ThemeLayer.js, line 36 -
获取图层事件。
Returns:
Type Description Object 返回图层支持的事件。 -
inherited getFeatureBy(property, value)
document/theme/ThemeLayer.js, line 236 -
在专题图的要素数组 features 里面遍历每一个 feature,当 feature[property] === value 时,返回此 feature(并且只返回第一个)。
Name Type Description propertystring 要的某个属性名。
valuestring 对应属性名得值。
-
inherited getFeatureById(featureId)
document/theme/ThemeLayer.js, line 252 -
通过给定一个 ID,返回对应的矢量要素,如果不存在则返回 null。
Name Type Description featureIdnumber 要素 ID。
-
inherited getFeatures(){Array}
document/theme/ThemeLayer.js, line 221 -
查看当前图层中的有效数据。
Returns:
Type Description Array 返回图层中的有效数据。 -
inherited getFeaturesByAttribute(attrName, attrValue){Array}
document/theme/ThemeLayer.js, line 261 -
通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
Name Type Description attrNamestring key 值。
attrValuestring value 值。
Returns:
Type Description Array 返回所有匹配的要素数组。 -
inherited getLocalXY(coordinate)
document/theme/ThemeLayer.js, line 413 -
地理坐标转为像素坐标。
Name Type Description coordinateArray -
getShapesByFeatureID(featureID)
document/theme/GraphThemeLayer.js, line 220 -
通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
Name Type Description featureIDnumber 要素 ID。
-
getWeightFieldValue(feature, weightField, defaultValue)
document/theme/GraphThemeLayer.js, line 516 -
获取权重字段的值。
Name Type Description featurezondy.Feature.Vector 矢量要素。
weightFieldArray.<string> 字段名数组。
defaultValuenumber 当通过 weightField 获取不到权重值时,使用 defaultValue 作为权重值。
-
initialize(name, chartsType, options)
document/theme/GraphThemeLayer.js, line 41 -
初始化。
Name Type Description namestring 专题图名。
chartsTypestring 图表类型。目前可用:"Bar","Bar3D","Line","Point","Pie","Ring"。
optionsObject 需要设置的参数对象。
-
isChartInMap(mapPxBounds, chartPxBounds)
document/theme/GraphThemeLayer.js, line 399 -
判断图表是否在地图里。
Name Type Description mapPxBoundszondy.Bounds 地图像素范围。
chartPxBoundsArray.<Object> 图表范围的四边形节点数组。 例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
-
isPointInPoly(pt, poly)
document/theme/GraphThemeLayer.js, line 379 -
判断一个点是否在多边形里面。(射线法)
Name Type Description ptObject 需要判定的点对象,该对象含有属性x(横坐标),属性y(纵坐标)。
polyArray.<Object> 多边形节点数组。
例如一个四边形:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}] -
isQuadrilateralOverLap(rect1, rect2)
document/theme/GraphThemeLayer.js, line 243 -
判断两个四边形是否有压盖。
Name Type Description rect1Array.<Object> 四边形节点数组。
rect2Array.<Object> 第二个四边形节点数组。
Example
[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]; -
lineIntersection(a1, a2, b1, b2){Object}
document/theme/GraphThemeLayer.js, line 331 -
判断两条线段是不是有交点。
Name Type Description a1zondy.geometry.Point 第一条线段的起始节点。
a2zondy.geometry.Point 第一条线段的结束节点。
b1zondy.geometry.Point 第二条线段的起始节点。
b2zondy.geometry.Point 第二条线段的结束节点。
Returns:
Type Description Object 如果相交返回交点,如果不相交返回两条线段的位置关系。 -
inherited off(event, callback, context)
document/theme/ThemeLayer.js, line 372 -
移除专题要素事件监听。
Name Type Description eventEvent 监听事件。
callbackfunction 回调函数。
contextstring 信息。
-
inherited on(event, callback, context)
document/theme/ThemeLayer.js, line 355 -
添加专题要素事件监听。添加专题要素事件监听。
Name Type Description eventEvent 监听事件。
callbackfunction 回调函数。
contextstring 信息。
-
inherited onRemove(map)
document/theme/ThemeLayer.js, line 54 -
删除某个地图。
Name Type Description mapL.Map 要删除的地图。
-
redraw()
document/theme/GraphThemeLayer.js, line 492 -
重绘该图层,成功则返回 true,否则返回 false。
-
redrawThematicFeatures(bounds)
document/theme/GraphThemeLayer.js, line 107 -
重绘所有专题要素 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,压盖处理,缓存等步骤。地图漫游时调用此方法进行图层刷新。
Name Type Description boundsL.bounds 重绘的范围。
-
removeAllFeatures()
document/theme/GraphThemeLayer.js, line 482 -
清除当前图层所有的矢量要素。
-
removeFeatures(features)
document/theme/GraphThemeLayer.js, line 470 -
从专题图中删除 feature。这个函数删除所有传递进来的矢量要素(数据)。
Name Type Description featuresObject 待删除的要素。
-
setChartsType(chartsType)
document/theme/GraphThemeLayer.js, line 62 -
设置图表类型,此函数可动态改变图表类型。在调用此函数前请通过 chartsSetting 为新类型的图表做相关配置。图表类型,目前支持:"Bar", "Bar3D", "Line","Point","Pie","Ring"。
Name Type Description chartsTypestring 图表类型。目前可用:"Bar", "Bar3D", "Line","Point","Pie","Ring"。
-
inherited setOpacity(opacity)
document/theme/ThemeLayer.js, line 321 -
设置图层的不透明度,取值 [0-1] 之间。
Name Type Description opacitynumber 不透明度。
-
inherited update(bounds)
document/theme/ThemeLayer.js, line 285 -
更新图层。
Name Type Description boundsL.bounds 图层范围。