网站首页
百度ECharts
ECharts实例
ECharts入门
地图大全
ECharts官网
源代码:
点击运行 》
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>ECharts 实例</title> <script src="/js/jquery-1.9.0.min.js"></script> <!-- 引入 echarts.js --> <script src="/js/echarts.min.js"></script> </head> <body> <div id="map" style="width: 100%;height:450px;"></div> <script type="text/javascript"> var uploadedDataURL = '/json/dwq.geojson' var myChart = echarts.init(document.getElementById('map')); function cityMap() { $.get(uploadedDataURL, function(geoJson) { echarts.registerMap('中国各市县形状', geoJson); option = { backgroundColor: '#040c33', title: { show: true, x: "center", y: "20", text: "粤港澳大湾区区域地图", textStyle: { color: "#fff", fontSize: 22, fontWeight: 'normal' } }, "geo": { "map": "中国各市县形状", "layoutCenter": ["50%", "55%"], "layoutSize": "82%", "roam": false, //是否允许缩放 "mapLocation": { "width": "100%", "height": "85%" }, label: { normal: { //静态的时候展示样式 show: false, //是否显示地图份得名称 textStyle: { color: "#fff", fontSize: 12 } }, emphasis: { //动态展示的样式 color: '#fff', }, }, "itemStyle": { normal: { areaColor: 'rgba(58, 127, 213, .2)', borderColor: '#0a53e9', //线 shadowColor: '#092f8f', //外发光 shadowBlur: 50 }, "emphasis": { color: 'rgba(58, 127, 213, 1)' //悬浮背景 } } }, }, myChart.setOption(option); window.addEventListener("resize", function() { myChart.resize(); }) }); } cityMap() </script> </body> </html>
运行结果: