第三方集成
# 第三方集成
在三维场景中添加第三方的地图库
# Joint3d.ChartLayer
图表图层,继承于Layer
# example
let chartLayer = new Joint3d.ChartLayer('layer')
viewer.addLayer(chartLayer)
注意
图表图层依赖于 echarts 库,使用前请确保全局变量中能够获取到 echarts
# creation
constructor([id],[option])
构造函数
- 参数
{String} id
:唯一标识{Object} option
:echarts 配置,详情参考:echarts (opens new window)
- 返回值
chartLayer
- 参数
// options,其他的参数参考 echarts
{
"animation": false, // 必须要加
"GLMap": {}, //地图
"series": [
{
"coordinateSystem": "GLMap" // 坐标系统
}
]
}
# methods
setOption(option)
设置点位
- 参数
{Object} option
:echarts 配置,详情参考:echarts (opens new window)
- 返回值
this
- 参数
# Joint3d.MapvDataSet
# example
let geoCoordMap = {
上海: [121.4648, 31.2891],
东莞: [113.8953, 22.901],
东营: [118.7073, 37.5513],
中山: [113.4229, 22.478],
临汾: [111.4783, 36.1615],
}
let data = []
for (let key in geoCoordMap) {
let geoCoord = geoCoordMap[key]
data.push({
geometry: {
type: 'Point',
coordinates: [
geoCoord[0] - 2 + Math.random() * 4,
geoCoord[1] - 2 + Math.random() * 4,
],
},
count: 30 * Math.random(),
})
}
let dataset = new Joint3d.MapvDataSet(data)
# creation
constructor(data)
构造函数
- 参数
{Array<Object>} data
:数据数组,详情参考:DataSet (opens new window)
- 返回值
dataset
- 参数
// 数据说明
{
"geometry": {
"type": "Point", // 类别,有:Point、Polygon、LineString
"coordinates": [123, 23] // 坐标,线和面是二位数组
},
"count": 30, // 用于阈值计算
"time": 100 * Math.random() // 步长 用于动画
}
# Joint3d.MapvLayer
数据可视化图层,继承于Layer
# example
let options = {
fillStyle: 'rgba(55, 50, 250, 0.8)',
shadowColor: 'rgba(255, 250, 50, 1)',
shadowBlur: 20,
size: 40,
globalAlpha: 0.5,
label: {
show: true,
fillStyle: 'white',
},
animation: {
type: 'time',
stepsRange: {
start: 0,
end: 100,
},
trails: 10,
duration: 4,
},
gradient: {
0.25: 'rgb(0,0,255)',
0.55: 'rgb(0,255,0)',
0.85: 'yellow',
1.0: 'rgb(255,0,0)',
},
draw: 'grid',
}
let layer = new Joint3d.MapvLayer('layer', options)
viewer.addLayer(layer)
# creation
constructor(id,options)
构造函数
- 参数
{String} id
:图层唯一标识{Object} options
:属性
- 返回值
mapvLayer
- 参数
// 属性参数(可选)
{
"fillStyle": "rgba(55, 50, 250, 0.8)", //颜色
"shadowColor": "rgba(255, 250, 50, 1)", // 阴影颜色
"shadowBlur": 20, // 阴影扩散
"size": 40, // 点大小
"globalAlpha": 0.5, //
"globalCompositeOperation": "lighter",
"label": {
"show": true,
"fillStyle": "white"
}, // 文字
"animation": {
"type": "time",
"stepsRange": {
"start": 0,
"end": 100
},
"trails": 10,
"duration": 4
}, //动画
"lineWidth": 0.7, // 线宽
"lineDash": [15], // 虚线
"gradient": {
0.25: "rgb(0,0,255)",
0.55: "rgb(0,255,0)",
0.85: "yellow",
1.0: "rgb(255,0,0)"
}, //渐变
"draw": "grid" //展现方式 有:simple:简单、intensity:强度、honeycomb:蜂巢、grid:格子等
}
# methods
setDataSet(dataset)
设置点位
- 参数
{MapvDataSet} dataset
: 数据配置
- 返回值
this
- 参数