map_bak.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. function lnMap(placeList,fl){
  2. option = {
  3. backgroundColor: '',
  4. color: [
  5. 'rgba(255, 255, 255, 0.8)',
  6. 'rgba(14, 241, 242, 0.8)',
  7. 'rgba(37, 140, 249, 0.8)'
  8. ],
  9. tooltip: {
  10. show:false,
  11. trigger: 'item',
  12. formatter: function (params) {
  13. // console.log(params.name);
  14. var html='';
  15. var html='<div id="dttk" style="background: url(\'./img/sy/03/tk_bak.png\') no-repeat 0 0;background-size:100% 100%;width: 200px;height: 152px;position: absolute;padding: 16px 10px 0px 10px;">'
  16. +'<div style="text-align: left;padding-left: 10px;padding-top: 5px;color: #2D68D0;font-size: 16px;background-color: #0a0a38;height:125px">'
  17. +'<p>卡口点位总数:54</p>'
  18. +'<p>WIFI点位总数:642</p>'
  19. +'<p>电围电围总数:325</p>'
  20. +'<p>视频点位总数:222</p>'
  21. +'</div>'
  22. +'</div>'
  23. ;
  24. // setTimeout(function() {
  25. // toolipCharts(params.name);
  26. // }, 3000);
  27. return html;
  28. }
  29. },
  30. geo: {
  31. map: 'ln',
  32. label: {
  33. emphasis: {
  34. show: false
  35. }
  36. },
  37. roam: false,
  38. zoom : 1.26,// 放大
  39. itemStyle: {
  40. normal: {
  41. areaColor: 'rgba(1,35,120,.7)',
  42. borderColor: 'rgba(100,149,237,1)',
  43. borderWidth:1.5
  44. },
  45. emphasis: {
  46. areaColor: 'transparent'
  47. }
  48. }
  49. },
  50. series : [
  51. {
  52. name: '强',
  53. type: 'effectScatter',
  54. coordinateSystem: 'geo',
  55. data: (function(){
  56. var data = [];
  57. var len = 50;
  58. var geoCoord
  59. while(len--) {
  60. geoCoord = placeList[len % placeList.length].geoCoord;
  61. data.push({
  62. name : placeList[len % placeList.length].name + len,
  63. value : [
  64. geoCoord[0] + Math.random() * 2 * -1,
  65. geoCoord[1] + Math.random() * 1 * -1,
  66. 10
  67. ]
  68. })
  69. }
  70. return data;
  71. })(),
  72. symbolSize:4,
  73. showEffectOn: 'render',
  74. large:true,
  75. rippleEffect: {
  76. brushType: 'stroke',
  77. period:5,
  78. scale:3,
  79. },
  80. hoverAnimation: true,
  81. label: {
  82. normal: {
  83. formatter: '{per|{b}}',
  84. position: 'right',
  85. show: false,
  86. rich:{
  87. per: {
  88. color: '#eee',
  89. backgroundColor: '#334455',
  90. padding: [2, 4],
  91. borderRadius: 2
  92. }
  93. }
  94. },
  95. emphasis: {
  96. show: false
  97. }
  98. },
  99. },
  100. {
  101. name: '中',
  102. type: 'effectScatter',
  103. coordinateSystem: 'geo',
  104. data: (function(){
  105. var data = [];
  106. var len = 200;
  107. var geoCoord
  108. while(len--) {
  109. geoCoord = placeList[len % placeList.length].geoCoord;
  110. data.push({
  111. name : placeList[len % placeList.length].name + len,
  112. value : [
  113. geoCoord[0] + Math.random()* 2* -1,
  114. geoCoord[1] + Math.random()* 2 * -1,
  115. 10
  116. ]
  117. })
  118. }
  119. return data;
  120. })(),
  121. symbolSize:4,
  122. showEffectOn: 'render',
  123. large:true,
  124. rippleEffect: {
  125. brushType: 'stroke',
  126. scale:3,
  127. },
  128. hoverAnimation: true,
  129. label: {
  130. normal: {
  131. formatter: '{b}',
  132. position: 'right',
  133. show: false
  134. }
  135. },
  136. },
  137. {
  138. name: '弱',
  139. type: 'effectScatter',
  140. coordinateSystem: 'geo',
  141. data: (function(){
  142. var data = [];
  143. var len = 185;
  144. var geoCoord
  145. while(len--) {
  146. geoCoord = placeList[len % placeList.length].geoCoord;
  147. data.push({
  148. name : placeList[len % placeList.length].name + len,
  149. value : [
  150. geoCoord[0] + Math.random() * 2 * -1,
  151. geoCoord[1] + Math.random() * 2 * -1,
  152. 10
  153. ]
  154. })
  155. }
  156. return data;
  157. })(),
  158. symbolSize:4,
  159. showEffectOn: 'render',
  160. large:true,
  161. rippleEffect: {
  162. brushType: 'stroke',
  163. scale:3,
  164. },
  165. hoverAnimation: true,
  166. label: {
  167. normal: {
  168. formatter: '{b}',
  169. position: 'right',
  170. show: false
  171. }
  172. },
  173. },
  174. {
  175. type:'map',
  176. mapType: 'ln',
  177. data: [
  178. { name: '铁岭市', value: Math.round(Math.random() * 1000) },
  179. { name: '沈阳市', value: Math.round(Math.random() * 1000) },
  180. { name: '朝阳市', value: Math.round(Math.random() * 1000) },
  181. { name: '抚顺市', value: Math.round(Math.random() * 1000) },
  182. { name: '阜新市', value: Math.round(Math.random() * 1000) },
  183. { name: '葫芦岛市', value: Math.round(Math.random() * 1000) },
  184. { name: '锦州市', value: Math.round(Math.random() * 1000) },
  185. { name: '盘锦市', value: Math.round(Math.random() * 1000) },
  186. { name: '营口市', value: Math.round(Math.random() * 1000) },
  187. { name: '辽阳市', value: Math.round(Math.random() * 1000) },
  188. { name: '本溪市', value: Math.round(Math.random() * 1000) },
  189. { name: '丹东市', value: Math.round(Math.random() * 1000) },
  190. { name: '鞍山市', value: Math.round(Math.random() * 1000) },
  191. { name: '大连市', value: Math.round(Math.random() * 1000) },
  192. { name: '康平县', value: Math.round(Math.random() * 1000) },
  193. { name: '法库县', value: Math.round(Math.random() * 1000) },
  194. { name: '新民市', value: Math.round(Math.random() * 1000) },
  195. { name: '沈北新区', value: Math.round(Math.random() * 1000) },
  196. { name: '辽中县', value: Math.round(Math.random() * 1000) },
  197. { name: '苏家屯区', value: Math.round(Math.random() * 1000) },
  198. { name: '于洪区', value: Math.round(Math.random() * 1000) },
  199. { name: '皇姑区', value: Math.round(Math.random() * 1000) },
  200. { name: '大东区', value: Math.round(Math.random() * 1000) },
  201. { name: '铁西区', value: Math.round(Math.random() * 1000) },
  202. { name: '和平区', value: Math.round(Math.random() * 1000) },
  203. { name: '沈河区', value: Math.round(Math.random() * 1000) },
  204. { name: '东陵区', value: Math.round(Math.random() * 1000) },
  205. { name: '灯塔市', value: Math.round(Math.random() * 1000) },
  206. { name: '白塔区', value: Math.round(Math.random() * 1000) },
  207. { name: '文圣区', value: Math.round(Math.random() * 1000) },
  208. { name: '太子河区', value: Math.round(Math.random() * 1000) },
  209. { name: '宏伟区', value: Math.round(Math.random() * 1000) },
  210. { name: '弓长岭区', value: Math.round(Math.random() * 1000) },
  211. { name: '辽阳县', value: Math.round(Math.random() * 1000) },
  212. { name: '溪湖区', value: Math.round(Math.random() * 1000) },
  213. { name: '明山区', value: Math.round(Math.random() * 1000) },
  214. { name: '平山区', value: Math.round(Math.random() * 1000) },
  215. { name: '南芬区', value: Math.round(Math.random() * 1000) },
  216. { name: '本溪满族自治县', value: Math.round(Math.random() * 1000) },
  217. { name: '桓仁满族自治县', value: Math.round(Math.random() * 1000) },
  218. ],
  219. label: {
  220. normal:{
  221. show: true,
  222. formatter: function(params){
  223. if(fl==''){
  224. return params.name;
  225. }else{
  226. return params.name+'\n\n'+fl+':'+params.value;
  227. }
  228. },
  229. position:'inside',
  230. padding:[4,5],
  231. borderRadius:3,
  232. borderWidth:1,
  233. borderColor:'rgba(255,255,255,.5)',
  234. textStyle: {
  235. color:'white',
  236. fontSize:'16'
  237. }
  238. },
  239. emphasis: {
  240. show: true,
  241. textStyle: {
  242. color:'white'
  243. }
  244. }
  245. },
  246. roam: false,
  247. zoom : 1.26,// 放大
  248. itemStyle: {
  249. normal: {
  250. areaColor: 'rgba(1,35,120,.7)',
  251. borderColor: 'rgba(100,149,237,1)',
  252. borderWidth:1.5
  253. },
  254. emphasis: {
  255. areaColor: 'transparent'
  256. }
  257. }
  258. }
  259. ]
  260. };
  261. return option;
  262. }
  263. var url='./js/ln.json';
  264. var symbolSize_bak=0;
  265. loadMap(url,symbolSize_bak,'');
  266. function loadMap(url,symbolSize_bak,fl){
  267. $.get(url, function (chinaJson) {
  268. echarts.registerMap('ln', chinaJson);
  269. var chart = echarts.init(document.getElementById('lnmap'));
  270. chart.showLoading({
  271. text:'正在加载中..',
  272. color:'#fff',
  273. textColor:'#fff',
  274. maskColor:'rgba(255,255,255,0)',
  275. zlevel:0,
  276. });
  277. var placeList = [
  278. {name:'阜新', geoCoord:[121.680381,42.029923]},
  279. {name:'抚顺', geoCoord:[123.984642,41.899479]}
  280. ,{name:'本溪', geoCoord:[123.745478,41.492701]},
  281. {name:'铁岭', geoCoord:[123.79607,42.242175]},
  282. {name:'铁岭2', geoCoord:[123.915653,42.443491]},
  283. {name:'沈阳', geoCoord:[123.79607,42.242175]},
  284. ]
  285. var option=lnMap(placeList,fl);
  286. option.series[0].symbolSize=symbolSize_bak;
  287. option.series[1].symbolSize=symbolSize_bak;
  288. option.series[2].symbolSize=symbolSize_bak;
  289. chart.hideLoading();
  290. chart.setOption(option);
  291. chart.on('click',function(params){
  292. console.log(params.name);
  293. if(params.name=='本溪市'){
  294. //./js/data-1505284886122-SkAzQUUcZ.json
  295. loadMap('./js/bx.json',getNum(),'');
  296. }else if(params.name=='沈阳市'){
  297. loadMap('./js/sy.json',getNum(),'');
  298. }else if(params.name=='辽阳市'){
  299. loadMap('./js/ly.json',getNum(),'');
  300. }else{
  301. return;
  302. }
  303. $("#mapname").html(params.name);
  304. $("#mapTip").show();
  305. })
  306. // var count = 0;
  307. // var timeTicket = null;
  308. // var dataLength = option.series[3].data.length;
  309. // timeTicket && clearInterval(timeTicket);
  310. // timeTicket = setInterval(function() {
  311. // chart.dispatchAction({
  312. // type: 'downplay',
  313. // seriesIndex: 3,
  314. // });
  315. // chart.dispatchAction({
  316. // type: 'highlight',
  317. // seriesIndex: 3,
  318. // dataIndex: (count) % dataLength
  319. // });
  320. // chart.dispatchAction({
  321. // type: 'showTip',
  322. // seriesIndex: 3,
  323. // dataIndex: (count) % dataLength
  324. // });
  325. // count++;
  326. // }, 3000);
  327. //
  328. // chart.on('mouseover', function(params) {
  329. //// console.log(params)
  330. // clearInterval(timeTicket);
  331. // chart.dispatchAction({
  332. // type: 'downplay',
  333. // seriesIndex: 3
  334. // });
  335. // chart.dispatchAction({
  336. // type: 'highlight',
  337. // seriesIndex:3,
  338. // dataIndex: params.dataIndex
  339. // });
  340. // chart.dispatchAction({
  341. // type: 'showTip',
  342. // seriesIndex: 3,
  343. // dataIndex: params.dataIndex,
  344. // });
  345. // });
  346. // chart.on('mouseout', function(params) {
  347. // timeTicket && clearInterval(timeTicket);
  348. // timeTicket = setInterval(function() {
  349. // chart.dispatchAction({
  350. // type: 'downplay',
  351. // seriesIndex: 3,
  352. // });
  353. // chart.dispatchAction({
  354. // type: 'highlight',
  355. // seriesIndex: 3,
  356. // dataIndex: (count) % dataLength
  357. // });
  358. // chart.dispatchAction({
  359. // type: 'showTip',
  360. // seriesIndex: 3,
  361. // dataIndex: (count) % dataLength
  362. // });
  363. // count++;
  364. // }, 3000);
  365. // });
  366. });
  367. }
  368. $("#map_ln").on('click',function(){
  369. loadMap('./js/ln.json',getNum(),getZl());
  370. $("#mapTip").hide();
  371. $('#mapname').html('');
  372. })