echarts Map(地圖) 不一樣顏色區塊顯示

以河南地圖爲例:javascript

代碼以下:java

<h3>天翼日必達完成率</h3>
<div id="map" style="height:340px; text-align:left; padding:0 20px 20px 20px;"></div>
<script type="text/javascript">
var myChart = echarts.init(document.getElementById('map'));//初始化
myChart.setOption({
title: {
text: ''
},
tooltip : {
trigger: 'item',
/* formatter: '{b}',
itemSize:'14px'*/
},
/* dataRange: {
orient: 'vertical',
min: 0,
max: 55000,
text:['高','低'], // 文本,默認爲數值文本
splitNumber:0
},*/
dataRange: {
x: 'left',
y: 'center',
splitList: [
{start: 0.8, label: '80%以上', color: '#FF6699'},
{start: 0.6, end: 0.8, label: '60-80%', color: '#CC3300'},
{start: 0.4, end: 0.6, label: '40-60%', color: '#F7BB37'},
{start: 0.3, end: 0.4, label: '30-40%', color: '#3BAE56'},
{start: 0.2, end: 0.3, label: '20-30%', color: '#92D050'},
{start: 0.1, end: 0.2, label: '10-20%', color: '#3899FF'},
{start: 0, end: 0.1, label: '0-10%', color: '#BFBFBF'}
],
textStyle: {
color: '#3899FF' // 值域文字顏色
},
selectedMode: false,
color: ['#E0022B', '#E09107', '#A3E00B']
},
series : [
{
name: '天翼日必達完成率',
type: 'map',
mapType: '河南',
mapLocation: {
x: 'left'
},
itemStyle:{
normal:{
label:{show:true}
},
emphasis:{label:{show:true}}
},
data:[
{name:'鄭州市', value:0.9},
{name:'開封市', value:0.6},
{name:'洛陽市', value:0.5},
{name:'平頂山市', value:0.7},
{name:'安陽市', value:0.2},
{name:'鶴壁市', value:0.35},
{name:'新鄉市', value:0.26},
{name:'焦做市', value:0.62},
{name:'濮陽市', value:0.82},
{name:'許昌市', value:0.56},
{name:'漯河市', value:0.24},
{name:'三門峽市', value:0.32},
{name:'南陽市', value:0.29},
{name:'商丘市', value:0.42},
{name:'信陽市', value:0.22},
{name:'周口市', value:0.12},
{name:'駐馬店市', value:0.42},
{name:'濟源市', value:0.05}
]
}],
});
</script>echarts

一次真實項目中遇到 記錄下 以防忘記。orm

相關文章
相關標籤/搜索