new ThemeManager(viewer, options)
engineExtensions/analysis/ThemeManager.js, line 4
请参考以下示例:
1、统计图支持如下方法:
[1、查询][1、根据查询结果添加专题图]
[1、根据统一的geoJson格式添加专题图]
[1、删除专题图]
统计图
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
viewer |
Object |
场景视图对象,详见Cesium.Viewer |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
附加参数
|
Example
// 参考示例:
http://webclient.smaryun.com/#/modules/cesium/visualization/themeLayer/statistic
// ES5引入方式
const { ThemeManager } = zondy.cesium
// ES6引入方式
import { ThemeManager } from "@mapgis/webclient-cesium-plugin"
// 1 初始化一个统计专题图对象
const themeManager = new zondy.cesium.ThemeManager(
// Cesium场景视图对象
viewer,
// 额外初始化参数
{}
)
// 2 添加水平柱状专题图
// 设置用于显示的属性名
themeManager.attributeName = ['GDP_2007', 'GDP_2008']
// 设置各个属性对应的颜色
themeManager.attributeColor = [
new Cesium.Color(234 / 255, 175 / 255, 200 / 255),
new Cesium.Color(56 / 255, 239 / 255, 125 / 255)
]
// 设置文本颜色
themeManager.textColor = Cesium.Color.GREEN
// 设置文本高度
themeManager.textHeightOffset = 10000
// 设置柱状图宽度
themeManager.width = 50000
// 添加专题图数据
themeManager.addByGeoJson(
// GeoJSON数据
{},
// 统计图类型
'HorizontalColumn'
)
// 3 添加垂直柱状专题图
// 解析GeoJson数据时,是否绘制polygon的Geometry
themeManager.addGeoGeometry = false
// 设置用于显示的属性名
themeManager.attributeName = ['GDP_2007', 'GDP_2008']
// 设置各个属性对应的颜色
themeManager.attributeColor = [
new Cesium.Color(234 / 255, 175 / 255, 200 / 255),
new Cesium.Color(56 / 255, 239 / 255, 125 / 255)
]
// 设置柱状图宽度
themeManager.width = 50000
// 添加专题图数据
themeManager.addByGeoJson(
// GeoJSON数据
{},
// 统计图类型
'VerticalColumn'
)
// 4 添加饼状不带高程专题图
// 解析GeoJson数据时,是否绘制polygon的Geometry
themeManager.addGeoGeometry = false
// 是否为饼状体添加高度
themeManager.addExtrudedHeight = false
// 设置用于显示的属性名
themeManager.attributeName = ['GDP_2007', 'GDP_2008']
// 设置各个属性对应的颜色
themeManager.attributeColor = [
new Cesium.Color(109 / 255, 213 / 255, 250 / 255),
new Cesium.Color(245 / 255, 175 / 255, 25 / 255)
]
// 设置柱状图宽度
themeManager.width = 50000
// 添加专题图数据
themeManager.addByGeoJson(
// GeoJSON数据
{},
// 统计图类型
'Pie'
)
// 5 添加饼状不带高程专题图
// 解析GeoJson数据时,是否绘制polygon的Geometry
themeManager.addGeoGeometry = false
// 是否为饼状体添加高度
themeManager.addExtrudedHeight = true
// 设置用于显示的属性名
themeManager.attributeName = ['GDP_2007', 'GDP_2008']
// 设置各个属性对应的颜色
themeManager.attributeColor = [
new Cesium.Color(109 / 255, 213 / 255, 250 / 255),
new Cesium.Color(245 / 255, 175 / 255, 25 / 255)
]
// 设置柱状图宽度
themeManager.width = 50000
// 添加专题图数据
themeManager.addByGeoJson(
// GeoJSON数据
{},
// 统计图类型
'Pie'
)
Members
-
addExtrudedHeightNumber
-
是否为饼状体添加高度
-
addGeoGeometryNumber
-
解析GeoJson数据时,是否绘制polygon的Geometry
-
attributeNameObject
-
用于显示的属性名
-
heightScaleNumber
-
设置柱状图的高度缩放比例
-
nearFarScalarObject
-
在指定距离内是否可见
-
textColorCesium.Color
-
标注颜色
-
textFontString
-
标注字体
-
textHeightOffsetNumber
-
字体高度的偏移值
-
widthNumber
-
显示柱状体或饼状的宽度
Methods
-
addByGeoJson(geoJson, themeType)
engineExtensions/analysis/ThemeManager.js, line 553 -
Name Type Description geoJsonObject GeoJson格式数据
themeTypeString 专题图类型
-
addByQueryResult(themeType)
engineExtensions/analysis/ThemeManager.js, line 412 -
Name Type Description themeTypeString 专题图类型
-
query(queryUrl)
engineExtensions/analysis/ThemeManager.js, line 362 -
Name Type Description queryUrlString Rest服务查询url
-
remove()
engineExtensions/analysis/ThemeManager.js, line 893 -