配置项如下
$.getJSON("/asset/get/s/data-1561113560628-m2I1N0Qi9.json", function(data) {
echarts.registerMap('3s', data);
//定义div#map,给定width和height
chart = echarts.init(document.getElementById('map'));
chart.setOption({
title: {
text: 'title',
},
toolbox: {
show: true,
orient: 'vertical',
left: 'right',
top: 'center',
feature: {
saveAsImage: {
backgroundColor: '#fff',
excludeComponents: ['toolbox']
}
}
},
visualMap: {
type: 'piecewise',
show: false, //图例
pieces: [{
value: 0,
color: '#ff0000',
label: '红色'
},
{
value: 1,
color: '#FF8330',
label: '橙色'
}
],
right: 0,
bottom: 0,
align: 'left',
padding: [30, 10, 10, 10], //上、右、下、左
borderWidth: 1,
borderColor: '#000',
itemGap: 1500,
itemSymbol: 'rect',
itemWidth: 30,
itemHeight: 200,
inverse: true
},
series: [{
selectedMode: false,
silent: true,
type: 'map',
roam: true,
label: {
normal: {
show: true,
formatter: '{c}', //显示数值在地图上
textStyle: {
color: '#f00',
fontWeight: "bold"
}
}
},
//这个需要程序处理
}]
});
})