var canvas = document.createElement('canvas')
var myChart = echarts.init(canvas, null, {
width: 4096,
height: 2048
})
var option = {
tooltip: {
trigger: 'item'
},
legend: {
data: ['test']
},
backgroundColor: 'rgba(0,0,0,0)',//canvas的背景颜色
globe: {
/*baseTexture: 'images/earth3d/world.topo.bathy.200401.jpg',
heightTexture: 'images/earth3d/bathymetry_bw_composite_4k.jpg',*/
baseTexture: myChart,
heightTexture: this.heightTexture,
shading: 'lambert',
light: {
ambient: {
intensity: 1
},
main: {
intensity: 1
}
},
top: 'middle',
left: 'center',
displacementScale: 0,
// environment: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
// offset: 0, color: '#00aaff' // 天空颜色
// }, {
// offset: 0.7, color: '#998866' // 地面颜色
// }, {
// offset: 1, color: '#998866' // 地面颜色
// }], false),
viewControl: {
distance: 240,
autoRotate: false,
targetCoord: [120.52, 30.4]
}
},
series: [
{
type: 'lines3D',
effect: {
show: true,
period: 3,//速度
trailLength: 0.1//尾部阴影
},
silent: false,
lineStyle: {//航线的视图效果
color: '#9ae5fc',
width: 10,
opacity: 0.6
},
// convertData
data: [[[-102.646409, 59.994255], [108.479, 23.1152]], [[-100.696295, 33.679979], [108.479, 23.1152]]]
}
]
}
myChart.setOption({
backgroundColor: 'rgba(3,28,72,1)',
geo: {
type: 'map',
map: 'world',
nameMap: nameMap,
left: 0,
top: 0,
right: 0,
bottom: 0,
boundingCoords: [[-180, 90], [180, -90]],
zoom: 0,
roam: false,
itemStyle: {
borderColor: '#000d2d',
normal: {
areaColor: '#2455ad',
borderColor: '#000c2d'
},
emphasis: {
areaColor: '#357cf8'
}
},
label: {
fontSize: 24
},
regions: [{
name: '中国',
selected: true,
itemStyle: {
normal: {
borderColor: '#b2a471'
},
},
}]
},
series: [
{
type: 'effectScatter',
coordinateSystem: 'geo',
zlevel: 3,
rippleEffect: {
brushType: 'stroke'
},
label: {
normal: {
show: true,
position: 'left',
fontSize: 18,
formatter: '{b}'
}
},
itemStyle: {
normal: {
color: '#ff0000'
}
},
data: [
{name: '南宁', value: [108.479, 23.1152], symbolSize: 20},
]
}
]
})
echarts.init(document.getElementById('container')).setOption(option, true)
// 地图点击事件
myChart.on('click', params => {
console.log(params)
})
请问楼主解决了么?