首页 > 代码库 > echarts绘制上海地图
echarts绘制上海地图
效果图:
<html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> </head> <body> <div id="main" style="100%; height: 100%;"></div> </body> <script src="http://www.mamicode.com/echarts-all.js"></script> <script> var myChart = echarts.init(document.getElementById(‘main‘)); var option = { title: { text : ‘上海地图‘, subtext : ‘-。-‘ }, tooltip : { trigger: ‘item‘, formatter: function(a){ return a[2]; } }, legend: { orient: ‘vertical‘, x:‘right‘, data:[‘数据名称‘] }, dataRange: { min: 0, max: 1000, color:[‘orange‘,‘yellow‘], text:[‘高‘,‘低‘], // 文本,默认为数值文本 calculable : true }, series : [ { name: ‘数据名称‘, type: ‘map‘, mapType: ‘上海‘, selectedMode : ‘single‘, itemStyle:{ normal:{label:{show:true}}, emphasis:{label:{show:true}} }, data:[ {name: ‘崇明县‘,value: Math.round(Math.random()*1000)}, {name: ‘宝山区‘,value: Math.round(Math.random()*1000)}, {name: ‘嘉定区‘,value: Math.round(Math.random()*1000)}, {name: ‘青浦区‘,value: Math.round(Math.random()*1000)}, {name: ‘杨浦区‘,value: Math.round(Math.random()*1000)}, {name: ‘虹口区‘,value: Math.round(Math.random()*1000)}, {name: ‘闸北区‘,value: Math.round(Math.random()*1000)}, {name: ‘普陀区‘,value: Math.round(Math.random()*1000)}, {name: ‘静安区‘,value: Math.round(Math.random()*1000)}, {name: ‘黄浦区‘,value: Math.round(Math.random()*1000)}, {name: ‘卢湾区‘,value: Math.round(Math.random()*1000)}, {name: ‘长宁区‘,value: Math.round(Math.random()*1000)}, {name: ‘徐汇区‘,value: Math.round(Math.random()*1000)}, {name: ‘浦东新区‘,value: Math.round(Math.random()*1000)}, {name: ‘松江区‘,value: Math.round(Math.random()*1000)}, {name: ‘闵行区‘,value: Math.round(Math.random()*1000)}, {name: ‘金山区‘,value: Math.round(Math.random()*1000)}, {name: ‘奉贤区‘,value: Math.round(Math.random()*1000)}, {name: ‘南汇区‘,value: Math.round(Math.random()*1000)} ] } ] }; myChart.setOption(option); </script> </html>
echarts绘制上海地图
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。