网站首页
百度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="main" style="width: 100%;height:380px;"></div> <script type="text/javascript"> var data1 = [ { name: '杭州', value: 9 } ]; var geoCoordMap = { '杭州': [116.407526, 39.904030] }; var convertData = function (data) { var res = []; for (var i = 0; i < data.length; i++) { var geoCoord = geoCoordMap[data[i].name]; if (geoCoord) { res.push({ name: data[i].name, value: geoCoord.concat(data[i].value) }); } } return res; }; var pointSize = 15; option = { backgroundColor: '#030c2b', geo: { map: 'china', label: { emphasis: { show: false } }, roam: true, itemStyle: { normal: { areaColor: '#0c52ca',//区域颜色 borderColor: '#1466d3', //线 shadowColor: '#092f8f', //外发光 shadowBlur: 20 }, emphasis: { areaColor: '#0a2dae'//鼠标Havor颜色 } } }, series: [ { name: '服务中', type: 'effectScatter', coordinateSystem: 'geo', data: convertData(data1), symbolSize: pointSize, showEffectOn: 'render', rippleEffect: { brushType: 'stroke' }, hoverAnimation: true, label: { normal: { formatter: '{b}', position: 'top', show: true } }, itemStyle: { normal: { color: '#4acdae', shadowBlur: 15, shadowColor: 'black' } }, zlevel: 1 } ] }; var myChart = echarts.init(document.getElementById('main')); myChart.setOption(option); </script> </body> </html>
运行结果: