1、自定义svg地图;
2、自定义图片地图;
3、内置热力图渲染;
配置项如下
/* 实现功能:
* 1、实现自定义svg地图渲染(官方示例常用json格式地图)
* 2、实现自定义图片地图渲染
* 3、实现热力图渲染
*/
// 自定义svg地图,在实际项目中可以使用svg或json版本地图,echarts都支持
let mapWidth = myChart.getWidth(),
mapHeight = myChart.getHeight();
let svgXML = `
<svg width="${mapWidth}" height="${mapHeight}" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="${mapWidth}" height="${mapHeight}" fill="rgba(255,255,255,0.5)"/>
</svg>
`;
echarts.registerMap('mymap', {
svg: svgXML
});
// 自定义图片地图
// let testMapImage = 'https://logo.baidu.com/images/logo.png';
let testMapImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAMgCAYAAAGsdzb+AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAKsFJREFUeNrsnW1ygyAQQN2MR+pReswcJXfajk1MbUQFZXGF937kTyYVeCwsH2NFVTvww40mQAggBCGAEIQAQhACCEEIIAQQghBACEIAIZXTN1fj76/hczyVk+7+cFU8mZ0Y/i+wHfeH7GxQ/W3I9TLK6xmfv8tbln2doFvrDKEIucKZrkZ9/2yIZWEpdV0TurcOf+V7y+mL95pcFZuWL9zw6z1yWZbJSDQpdyhixqivZA4JzwNi0rA55pzn35DQUHbbNFov6qCuszKclfa2IJx1SMbh7rQyIIQIATshQwqbPz9HCCAk13YEQhwgRIjPNFURAghBCBM7QgAhCIG6haQfwSKkyFqk5DPjTgsP7u8xZBEhgBCEAEKOZWsIAV9COPYlQhACCDGk0A0bhBAhEC+k5Alcpdd4ckdIiXSUm+/JQ5bl9nbl13iYQxACCEEIIAQQ4pG+2Zpbv06jOSFOG3QXw67Fa33GkHUu4iNCaurdx9phtqdHhJBlAUIQAtHZFUJcoQjxmm0hhDkEIji6MIxf4KW/fla2whshZRtHYzOTojsIy5flxEOEpMqT1DRwU5DXjGkQt2OLyNdu73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+ed71QyAwIAAAgQAABAgAAAADzt1P0nnu8xs5QuO7t9/K/wfNPx42ceAGBYgJRLAgYm/WzmB9cO8hbcEGgACBAAmgXZuECrs9a7YAJAgABQLYjmCSb4fzgLYBAghScU7/QAAPLD+RrAnjkDASJCAIBBYSJQ2FXQWenRt2Add08mAAB1AsUtXSBAfoyRvBMJ8Oxnqs2XO0CkMPn56rEZFFguQHI+wF9PCoddBR0/f/e/oB/9TAoWIG6oCBaiHat5ho2vj5SMC4CKrJI0+gsFmJ9godZ3bnmADDjuLMML1OULtEawzTbrK4jMxDvOevxdzbCwywnVDAgAGQMgDABHHW8GKs/EsWNzl89PyBkQAQIARA5gAxlBIkCePVYGHRduwQIA5nBvMPTYLYu7honbu5ieAAEAVgwUYdImWHIDUNCM2nc191sjbsECANbU5pkmAydWMOz5DwECAAiUtgy0mDdAPnQOEbdgAQB7Kh105QXMvVtdBAojpMzjU4AAAIQNmPL3/ogVWoRI9wgRIAAAswVLXqwIEkISIAAAs8dK+eyJYEGAAADwZJDc81ywCJT9eAYEAIAGwVLngflSAmfz8Pj3wy3DCwAA9PLXJgAAAAQIAAAgQAAAAAQIAAAgQAAAAAQIAAAgQAAAAAECAAAgQAAAAAECAAAgQAAAAAECAAAIEAAAAAECAAAIEAAAAAECAAAIEAAAQIAAAAAIEAAAQIAAAAAIEAAAQIAAAAACBAAAQIAAAAACBAAAQIAAAAACBAAAECAAAAACBAAAECAAAAACBAAAECAAAAACBAAAECAAAIAAAQAAECAAAIAAAQAAECAAAIAAAQAABAgAAIAAAQAAovkPwRgb1NNY1coAAAAASUVORK5CYII='
// 更新热力图数据
let heatData=[
{name:'点位1',value:50,x:200,y:170},
{name:'点位2',value:60,x:200,y:200},
{name:'点位3',value:70,x:300,y:300},
{name:'点位4',value:80,x:400,y:400},
{name:'点位5',value:90,x:400,y:300},
{name:'点位5',value:70,x:400,y:400},
{name:'点位6',value:20,x:420,y:400},
{name:'点位7',value:20,x:450,y:300},
{name:'点位8',value:5,x:480,y:400},
{name:'点位9',value:100,x:170,y:90},
{name:'点位10',value:100,x:420,y:90},
{name:'点位11',value:100,x:170,y:600},
{name:'点位12',value:100,x:555,y:680},
{name:'点位13',value:100,x:0,y:0},
{name:'点位14',value:100,x:590,y:0},
{name:'点位15',value:100,x:0,y:776},
{name:'点位16',value:100,x:345,y:776}
];
let handleHeatData = heatData.map(a => {
let obj = [a.y, a.x, a.value]
obj.push(a.value);
return obj;
});
/* 配置项
* 1、geo组件:渲染已注册地图
* 2、series.custom图表:渲染自定义的图片地图
* 3、visualMap组件和series.heatmap图表:渲染热力图
*/
option = {
backgroundColor: 'rgba(0,0,0,1)',
title: {
top: 30,
left: 'center',
text: '自定义热力图',
textStyle: {
fontSize: 30,
color: '#f00',
}
},
geo: {
map: 'mymap',
roam: true,
top: 0,
bottom: 0,
left: 0,
right: 0,
},
// 与热力图heatmap搭配使用
visualMap: {
type: 'continuous',
show: false,
min: 0,
max: 100,
inRange: {
color: ['#00f', '#ff0', '#f00'],
}
},
series: [
{
type: 'custom',
name: '自定义图片地图',
coordinateSystem: 'geo',
animation: false,
renderItem: function(params, api) {
let pos = api.coord([params.coordSys.x, params.coordSys.y]);
let size = api.size([params.coordSys.width, params.coordSys.height]);
let item = {
type: 'image',
style: {
image: testMapImage,
x: pos[0],
y: pos[1],
width: size[0],
height: size[1],
}
};
return item;
},
data: [0]
},
{
type: 'heatmap',
name: '热力图',
coordinateSystem: 'geo',
pointSize: 30,
blurSize: 50,
zlevel: 2,
animation: false,
// data: [
// // [lng1, lat1, value1], // [经度, 维度, 值]
// ],
data: handleHeatData
}
]
};
myChart.setOption(option);
// 此平台升级后貌似仅能执行一次setOption方法,本地demo运行正常
// 更新热力图数据
// let heatData=[
// {name:'点位1',value:50,x:200,y:170},
// {name:'点位2',value:60,x:200,y:200},
// {name:'点位3',value:70,x:300,y:300},
// {name:'点位4',value:80,x:400,y:400},
// {name:'点位5',value:90,x:400,y:300},
// {name:'点位5',value:70,x:400,y:400},
// {name:'点位6',value:20,x:420,y:400},
// {name:'点位7',value:20,x:450,y:300},
// {name:'点位8',value:5,x:480,y:400},
// {name:'点位9',value:100,x:170,y:90},
// {name:'点位10',value:100,x:420,y:90},
// {name:'点位11',value:100,x:170,y:600},
// {name:'点位12',value:100,x:555,y:680},
// {name:'点位13',value:100,x:0,y:0},
// {name:'点位14',value:100,x:590,y:0},
// {name:'点位15',value:100,x:0,y:776},
// {name:'点位16',value:100,x:345,y:776}
// ];
// let handleHeatData = heatData.map(a => {
// let obj = myChart.convertFromPixel('geo', [a.x, a.y]);
// obj.push(a.value);
// return obj;
// });
// myChart.setOption({
// title: {
// top: 30,
// left: 'center',
// text: '自定义热力图--此平台升级后只能执行一次setOption???',
// textStyle: {
// fontSize: 30,
// color: '#f00',
// }
// },
// series: [
// {
// type: 'custom',
// data: [1]
// },
// {
// type: 'heatmap',
// data: handleHeatData
// }
// ]
// });