Toggle navigation
“设备实行情况” - 驻马店市
By
h***笙
2020-08-15 01:01:01
脚本
16
21
作品使用的第三方脚本
http://mc3mc3.applinzi.com/map/jquery-3.4.1.js
数据管理
上传数据
支持小于 5M 任意格式(csv, xlsx, json, xml, ...)的数据文件
上传后可以通过生成的文件链接异步获取托管的数据。
历史数据
0 条
无历史数据
代码修改记录
信息提示
保存作品
对当前截图不满意?你还可以
上传本地截图
重新截图
作品名称
作品描述
标签
geo
grid
legend
markLine
markPoint
bar
effectScatter
line
lines
map
timeline
title
toolbox
tooltip
visualMap
作品默认版本
最新
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
20:11:45
图表已生成
整理代码
刷新
代码
//引入市区json文件 var uploadedDataURL = "/asset/get/s/data-1597452450339-dQm5JP9rx.json"; myChart.showLoading(); $.getJSON(uploadedDataURL, function(geoJson) { echarts.registerMap('china', geoJson); myChart.hideLoading(); //地理位置信息 var geoCoordMap = { '遂平县': [114.015819,33.150944], '上蔡县': [114.276256,33.267906], '西平县': [114.022143,33.394355], "驿城区": [114.006045,32.978599], '确山县': [114.033641,32.810768], "泌阳县": [113.335694,32.731107], "汝南县": [114.375141,33.016389], "正阳县": [114.398138,32.615372], "平舆县": [114.629254,32.969876], "新蔡县": [114.979952,32.752487] }; //数据信息 var data = [ {name:"遂平县",value:199}, {name:"上蔡县",value:42}, {name:"西平县",value:102}, {name:"驿城区",value:81}, {name:"确山县",value:47}, {name:"泌阳县",value:67}, {name:"汝南县",value:82}, {name:"正阳县",value:123}, {name:"平舆县",value:24}, {name:"新蔡县",value:92} ]; var max = 480, min = 9; // todo var maxSize4Pin = 100, minSize4Pin = 20; 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; }; option = { backgroundColor: { type: 'linear', x: 0, y: 0, x2: 1, y2: 1, colorStops: [{ offset: 0, color: '#0f378f' // 0% 处的颜色 }, { offset: 1, color: '#00091a' // 100% 处的颜色 }], globalCoord: false }, title: { top:20, text: '“设备实行情况” - 驻马店市', subtext: '', x: 'center', textStyle: { color: '#ccc' } }, tooltip: { trigger: 'item', formatter: function (params) { if(typeof(params.value)[2] == "undefined"){ return params.name + ' : ' + params.value; }else{ return params.name + ' : ' + params.value[2]; } } }, /* legend: { orient: 'vertical', y: 'bottom', x: 'right', data:['pm2.5'], textStyle: { color: '#fff' } },*/ legend: { orient: 'vertical', y: 'bottom', x:'right', data:['pm2.5'], textStyle: { color: '#fff' } }, visualMap: { show: false, min: 0, max: 500, left: 'left', top: 'bottom', text: ['高', '低'], // 文本,默认为数值文本 calculable: true, seriesIndex: [1], inRange: { } }, geo: { map: 'china', show: true, roam: true, center:[114.006045,32.978599], zoom : 7,//当前视角缩放比例 label: { normal: { show: false }, emphasis: { show: false, } }, itemStyle: { normal: { areaColor: '#3a7fd5', borderColor: '#0a53e9',//线 shadowColor: '#092f8f',//外发光 shadowBlur: 20 }, emphasis: { areaColor: '#0a2dae',//悬浮区背景 } } }, series : [ { symbolSize: 5, label: { normal: { formatter: '{b}', position: 'right', show: true }, emphasis: { show: true } }, itemStyle: { normal: { color: '#fff' } }, name: 'light', type: 'scatter', coordinateSystem: 'geo', data: convertData(data), }, { type: 'map', map: 'china', geoIndex: 0, aspectScale: 0.75, //长宽比 showLegendSymbol: false, // 存在legend时显示 label: { normal: { show: false }, emphasis: { show: false, textStyle: { color: '#fff' } } }, roam: true, itemStyle: { normal: { areaColor: '#031525', borderColor: '#FFFFFF', }, emphasis: { areaColor: '#2B91B7' } }, animation: false, data: data }, { name: 'Top 5', type: 'scatter', coordinateSystem: 'geo', symbol: 'pin', symbolSize: [50,50], label: { normal: { show: true, textStyle: { color: '#fff', fontSize: 9, }, formatter (value){ return value.data.value[2] } } }, itemStyle: { normal: { color: '#D8BC37', //标志颜色 } }, data: convertData(data), showEffectOn: 'render', rippleEffect: { brushType: 'stroke' }, hoverAnimation: true, zlevel: 1 }, ] }; myChart.setOption(option); });