124 lines
5.6 KiB
Plaintext
124 lines
5.6 KiB
Plaintext
通用:
|
|
g.g3d.getEye() // 获取视角位置
|
|
g.g3d.getCenter() // 获取视角中心位置
|
|
g.g3d.moveCamera(eye, center) // 移动视角到目标位置
|
|
g.event.add("clickProvince", e => console.log("clickProvince ->", e)); // 添加省份点击监听
|
|
g.event.add("clickCity", e => console.log("clickCity ->", e.province, e.city)); // 添加市级点击监听
|
|
g.event.add("clickDistrict", e => console.log("clickCity ->", e.province, e.city, e.district)); // 添加区级点击监听
|
|
在全国场景:
|
|
g.active3d.setProvinceFocusable(true|false) // 启用/禁用省份聚焦交互
|
|
g.active3d.riseProvince("湖北省") // 提升省级地块
|
|
g.active3d.fallProvince("湖北省") // 取消提升省级地块
|
|
g.active3d.clearAllRisenProvinces() // 取消提升所有省级地块
|
|
g.active3d.createFlywire("北京市","湖北省.荆州市") // 创建飞线,返回飞线节点(参数可以为1.省名;2.省名.市名;3.已创建的节点[柱图/饼图/气泡等])
|
|
g.active3d.clearAllFlywires() // 清除所有飞线
|
|
g.active3d.createBar(options) // 创建柱图,返回节点数组
|
|
g.active3d.clearAllBars() // 清除所有柱图
|
|
g.active3d.createPie(options) // 创建饼图,返回节点数组
|
|
g.active3d.clearAllPies() // 清除所有饼图
|
|
g.active3d.createBillboard(options) // 创建气泡,返回气泡节点
|
|
g.active3d.clearAllBillboards() // 清除所有气泡
|
|
g.active3d.clearAll() // 取消提升所有省级地块,清除所有柱图/饼图/气泡/飞线,重置所有地块染色和贴图
|
|
g.active3d.switchToProvince("湖南省", callback) // 切换到省级场景(目前可用的有湖南省/贵州省/山东省)
|
|
g.active3d.setPlotColor(location, color, removeTexture) // 设置地块染色,removeTexture 为 true 时移除贴图
|
|
g.active3d.resetPlotColor(location) // 重置地块染色和贴图
|
|
g.active3d.resetAllPlotsColor() // 重置所有地块染色和贴图
|
|
|
|
在省级场景:
|
|
g.active3d.riseCity("株洲市") // 提升市级地块
|
|
g.active3d.fallCity("株洲市") // 取消提升市级地块
|
|
g.active3d.clearAllRisenCitys() // 取消提升所有市级地块
|
|
g.active3d.createFlywire("株洲市","长沙市") // 创建飞线,返回飞线节点(参数可以为1.市名;2.市名.区名;3.已创建的节点[柱图/饼图/气泡等])
|
|
g.active3d.clearAllFlywires() // 清除所有飞线
|
|
g.active3d.createBar(options) // 创建柱图,返回节点数组
|
|
g.active3d.clearAllBars() // 清除所有柱图
|
|
g.active3d.createPie(options) // 创建饼图,返回节点数组
|
|
g.active3d.clearAllPies() // 清除所有饼图
|
|
g.active3d.createBillboard(options) // 创建气泡,返回气泡节点
|
|
g.active3d.clearAllBillboards() // 清除所有气泡
|
|
g.active3d.clearAll() // 取消提升所有省级地块,清除所有柱图/饼图/气泡/飞线,重置所有地块染色和贴图
|
|
g.active3d.switchToChina(callback) // 切换回全国场景
|
|
g.active3d.setPlotColor(location, color, removeTexture) // 设置地块染色,removeTexture 为 true 时移除贴图
|
|
g.active3d.resetPlotColor(location) // 重置地块染色和贴图
|
|
g.active3d.resetAllPlotsColor() // 重置所有地块染色和贴图
|
|
|
|
柱图 options 实例:
|
|
{
|
|
location: "湖北省", // 地名,参考飞线参数
|
|
width: 15, // 宽度
|
|
rotation: -45, // 旋转,角度制
|
|
offsetX: 5, // X方向偏移
|
|
offsetY: 0, // Y方向偏移
|
|
offsetZ: 0, // Z方向偏移(即高度)
|
|
onClick: (node, item) => console.log("click ->", node, item), // 点击触发回调
|
|
onEnter: (node, item) => console.log("enter ->", node, item), // 移入触发回调
|
|
onLeave: (node, item) => console.log("leave ->", node, item), // 移出触发回调
|
|
items: [
|
|
{
|
|
tall: 20, // 高度
|
|
color: "#00CF28", // 颜色
|
|
wfColor: "#03D61A", // 框线颜色
|
|
},
|
|
{
|
|
tall: 12,
|
|
color: "#AF380E",
|
|
wfColor: "#BD1408",
|
|
},
|
|
{
|
|
tall: 10,
|
|
color: "#047DB0",
|
|
wfColor: "#02BBD1",
|
|
},
|
|
{
|
|
tall: 5,
|
|
color: "#01E5A9",
|
|
wfColor: "#01C97F",
|
|
},
|
|
]
|
|
}
|
|
饼图 options 实例:
|
|
{
|
|
location: "湖北省", // 地名,参考飞线参数
|
|
width: 5, // 宽度
|
|
radius: 20, // 半径,必须大于宽度
|
|
height: 10, // 高度
|
|
rotation: -105, // 旋转,角度制
|
|
offsetX: 0, // X方向偏移
|
|
offsetY: 0, // Y方向偏移
|
|
offsetZ: 0, // Z方向偏移(即高度)
|
|
onClick: (node, item) => console.log("click ->", node, item), // 点击触发回调
|
|
onEnter: (node, item) => console.log("enter ->", node, item), // 移入触发回调
|
|
onLeave: (node, item) => console.log("leave ->", node, item), // 移出触发回调
|
|
items: [
|
|
{
|
|
value: 100, // 数据值1,影响占比
|
|
value2: 15, // 数据值2,影响高度
|
|
color: "#307FEB", // 颜色
|
|
},
|
|
{
|
|
value: 10,
|
|
value2: 10,
|
|
color: "#E5AA27",
|
|
},
|
|
{
|
|
value: 10,
|
|
value2: 10,
|
|
color: "#643ED3",
|
|
},
|
|
]
|
|
}
|
|
气泡 options 实例:
|
|
{
|
|
location: "湖南省", // 地名,参考飞线参数
|
|
type: "pie", // 类型(目前支持"default"、"pie"和"bar")
|
|
text: "湖南", // 显示文本
|
|
value: 10, // 显示数据值
|
|
scale: 0.8, // 缩放
|
|
fixSize: false, // 固定大小,开启时缩放无效
|
|
offsetX: 0, // X方向偏移
|
|
offsetY: 0, // Y方向偏移
|
|
offsetZ: 0, // Z方向偏移(即高度)
|
|
onClick: (node, item) => console.log("click ->", node, item), // 点击触发回调
|
|
onEnter: (node, item) => console.log("enter ->", node, item), // 移入触发回调
|
|
onLeave: (node, item) => console.log("leave ->", node, item), // 移出触发回调
|
|
} |