123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275 |
- // var uploadedDataURL = "/public/data/410000_city.json";
- var uploadedDataURL = "https://geo.datav.aliyun.com/areas/bound/410000_full.json";
- var myChart = echarts.init(document.getElementById('henan-map'));
- $.get(uploadedDataURL, function(geoJson) {
- echarts.registerMap('河南', geoJson);
- var allData = {
- "citys": [{
- "name": "郑州市",
- "value": [113.665412,34.757975],
- "symbolSize": 3,
- "itemStyle": {
- "normal": {
- "color": "#04b9ff"
- }
- }
- },
- {
- "name": "洛阳市",
- "value": [112.434468,34.663041],
- "symbolSize": 1,
- "itemStyle": {
- "normal": {
- "color": "#04b9ff"
- }
- }
- },
- {
- "name": "新乡市",
- "value": [113.883991,35.302616],
- "symbolSize": 1,
- "itemStyle": {
- "normal": {
- "color": "#04b9ff"
- }
- }
- },
- {
- "name": "开封市",
- "value": [114.341447,34.797049],
- "symbolSize": 1,
- "itemStyle": {
- "normal": {
- "color": "#04b9ff"
- }
- }
- },
- {
- "name": "南阳市",
- "value": [112.540918,32.999082],
- "symbolSize": 1,
- "itemStyle": {
- "normal": {
- "color": "#04b9ff"
- }
- }
- },
- {
- "name": "鹤壁市",
- "value": [114.295444,35.748236],
- "symbolSize": 1,
- "itemStyle": {
- "normal": {
- "color": "#04b9ff"
- }
- }
- },
- {
- "name": "濮阳市",
- "value": [115.041299,35.768234],
- "symbolSize": 1,
- "itemStyle": {
- "normal": {
- "color": "#04b9ff"
- }
- }
- },
- {
- "name": "驻马店市",
- "value": [114.024736,32.980169],
- "symbolSize": 1,
- "itemStyle": {
- "normal": {
- "color": "#04b9ff"
- }
- }
- }
- ],
- "moveLines": [{
- "fromName": "郑州市",
- "toName": "洛阳市",
- "coords": [
- [113.665412,34.757975],
- [112.434468,34.663041]
- ]
- },
- {
- "fromName": "郑州市",
- "toName": "新乡市",
- "coords": [
- [113.665412,34.757975],
- [113.883991,35.302616]
- ]
- },
- {
- "fromName": "郑州市",
- "toName": "开封市",
- "coords": [
- [113.665412,34.757975],
- [114.341447,34.797049]
- ]
- },
- {
- "fromName": "郑州市",
- "toName": "南阳市",
- "coords": [
- [113.665412,34.757975],
- [112.540918,32.999082]
- ]
- },
- {
- "fromName": "郑州市",
- "toName": "鹤壁市",
- "coords": [
- [113.665412,34.757975],
- [114.295444,35.748236]
- ]
- },
- {
- "fromName": "郑州市",
- "toName": "濮阳市",
- "coords": [
- [113.665412,34.757975],
- [115.041299,35.768234]
- ]
- },
- {
- "fromName": "郑州市",
- "toName": "驻马店市",
- "coords": [
- [113.665412,34.757975],
- [114.024736,32.980169]
- ]
- }
- ]
- };
- option = {
- backgroundColor:'rgba(128, 128, 128, 0.1)', //rgba设置透明度0.1
- title: {
- text: '',
- left: 'center',
- textStyle: {
- color: '#fff'
- }
- },
- legend: {
- show: false,
- orient: 'vertical',
- top: 'auto',
- left: 'right',
- data: ['地点', '线路'],
- textStyle: {
- color: '#fff'
- }
- },
- geo: {
- map: '河南',
- label: {
- emphasis: {
- show: false,
- textStyle: {
- color: '#fff',
- }
- }
- },
- roam: true,
- itemStyle: {
- normal: {
- borderColor: 'rgba(147, 235, 248, 1)',
- borderWidth: 1,
- areaColor: {
- type: 'radial',
- x: 0.5,
- y: 0.5,
- r: 0.8,
- colorStops: [{
- offset: 0,
- color: 'rgba(147, 235, 248, 0)' // 0% 处的颜色
- }, {
- offset: 1,
- color: 'rgba(147, 235, 248, .2)' // 100% 处的颜色
- }],
- globalCoord: false // 缺省为 false
- },
- shadowColor: 'rgba(128, 217, 248, 1)',
- // shadowColor: 'rgba(255, 255, 255, 1)',
- shadowOffsetX: -2,
- shadowOffsetY: 2,
- shadowBlur: 10
- },
- emphasis: {
- areaColor: '#389BB7',
- borderWidth: 0
- }
- }
- },
- series: [{
- name: '地点',
- type: 'effectScatter',
- coordinateSystem: 'geo',
- zlevel: 1,
- rippleEffect: {
- brushType: 'stroke',
- period: 7,
- scale: 26
- },
- label: {
- normal: {
- show: true,
- position: 'right',
- formatter: '{b}',
- textStyle:{
- fontSize: 14,
- color: '#fff'
- }
- },
- emphasis: {
- show: true,
- position: 'right',
- formatter: '{b}'
- }
- },
- symbolSize: 2,
- showEffectOn: 'render',
- itemStyle: {
- normal: {
- color: '#04b9ff',
- shadowBlur: 10,
- shadowColor: '#04b9ff'
- }
- },
- data: allData.citys
- }, {
- name: '线路',
- type: 'lines',
- coordinateSystem: 'geo',
- zlevel: 2,
- large: true,
- effect: {
- show: true,
- period: 4, //箭头指向速度,值越小速度越快
- trailLength: 0.02, //特效尾迹长度[0,1]值越大,尾迹越长重
- symbol: 'arrow', //箭头图标
- symbolSize: 5, //图标大小
- },
- lineStyle: {
- normal: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
- offset: 0,
- color: '#04b9ff'
- }, {
- offset: 1,
- color: '#04b9ff'
- }], false),
- width: 1, //尾迹线条宽度
- opacity: 1, //尾迹线条透明度
- curveness: .3 //尾迹线条曲直度
- }
- },
- data: allData.moveLines
- }]
- };
- myChart.setOption(option);
- });
|