当前位置:   article > 正文

使用echarts加载地图_echart j加载地图

echart j加载地图

echarts这样的插件很好用,在这直奔重点,以下为注意事项:
1.echarts高版本的是没有中国地图的实例的,使用echarts做低版本的中国地图,需要引入低版本的echarts,这里用的版本是是echarts-2.2.7。
2.引入echarts的方法有三种,模块化包引入,模块化单文件引入(推荐),标签式单文件引入在实例中的代码,引入的方法一般为第二种(不同的引入方式会导致报错),具体http://echarts.baidu.com/echarts2/doc/doc.html#引入ECharts2。
3.echarts中的demo只是简单例子,平常我们使用时要对照的官网上的api根据自己的需求去调试js。
以下是一个中国地图的例子,效果图如下:

  1. //设置一个DOM
  2. <table>
  3. <tr>
  4. <td width="50%">
  5. <div id="china-map" style="width: 100%; height: 350px;"></div>
  6. </td>
  7. <td width="50%">
  8. <div id="rmap" style="width: 100%; height: 350px;"></div>
  9. </td>
  10. </tr>
  11. </table>

然后引入js,写js代码

  1. <script language="JavaScript" src="<%=request.getContextPath()%>/Script/component/echarts-2.2.7/build/dist/echarts.js"></script>
  2. <script>
  3. $(document).ready(function(){
  4. echartsChina();
  5. echartsrmap();
  6. });
  7. require.config({
  8. paths: {
  9. echarts: '<%=request.getContextPath()%>/Script/component/echarts-2.2.7/build/dist'
  10. }
  11. });
  12. //初始化加载的右边图形的函数
  13. function echartsrmap(){
  14. require(
  15. [
  16. 'echarts',
  17. 'echarts/chart/line',
  18. 'echarts/chart/bar',
  19. 'echarts/chart/scatter',
  20. 'echarts/chart/k',
  21. 'echarts/chart/pie',
  22. 'echarts/chart/radar',
  23. 'echarts/chart/force',
  24. 'echarts/chart/chord',
  25. 'echarts/chart/gauge',
  26. 'echarts/chart/funnel',
  27. 'echarts/chart/eventRiver',
  28. 'echarts/chart/venn',
  29. 'echarts/chart/treemap',
  30. 'echarts/chart/tree',
  31. 'echarts/chart/wordCloud',
  32. 'echarts/chart/heatmap',
  33. 'echarts/chart/map'
  34. ],
  35. function (ec) {
  36. var myChart = ec.init(document.getElementById('rmap'));
  37. var option = {
  38. title : {
  39. text: '',
  40. subtext: '',
  41. x:'center'
  42. },
  43. tooltip : {
  44. trigger: 'item',
  45. formatter: "{a} <br/>{b} : {c} ({d}%)"
  46. },
  47. toolbox: {
  48. feature: {
  49. saveAsImage: {},
  50. restore: {},
  51. dataView: {}
  52. }
  53. },
  54. legend: {
  55. orient: 'vertical',
  56. x: 'left',
  57. data: ['北京','天津','上海','重庆','河北', '河南','云南','辽宁','黑龙江','湖南','安徽','山东','新疆','江苏','浙江', '江西', '湖北', '广西', '甘肃', '山西', '内蒙古', '陕西', '吉林', '福建',
  58. '贵州', '广东', '青海', '西藏', '四川', '宁夏', '海南', '台湾', '香港', '澳门']
  59. },
  60. series : [
  61. {
  62. name: '所占比例',
  63. type: 'pie',
  64. radius : '55%',
  65. center: ['50%', '60%'],
  66. data:[
  67. {name: '北京',value: Math.round(Math.random()*2000)},
  68. {name: '天津',value: Math.round(Math.random()*2000)},
  69. {name: '上海',value: Math.round(Math.random()*2000)},
  70. {name: '重庆',value: Math.round(Math.random()*2000)},
  71. {name: '河北',value: 0},
  72. {name: '河南',value: Math.round(Math.random()*2000)},
  73. {name: '云南',value: 5},
  74. {name: '辽宁',value: 305},
  75. {name: '黑龙江',value: Math.round(Math.random()*2000)},
  76. {name: '湖南',value: 200},
  77. {name: '安徽',value: Math.round(Math.random()*2000)},
  78. {name: '山东',value: Math.round(Math.random()*2000)},
  79. {name: '新疆',value: Math.round(Math.random()*2000)},
  80. {name: '江苏',value: Math.round(Math.random()*2000)},
  81. {name: '浙江',value: Math.round(Math.random()*2000)},
  82. {name: '江西',value: Math.round(Math.random()*2000)},
  83. {name: '湖北',value: Math.round(Math.random()*2000)},
  84. {name: '广西',value: Math.round(Math.random()*2000)},
  85. {name: '甘肃',value: Math.round(Math.random()*2000)},
  86. {name: '山西',value: Math.round(Math.random()*2000)},
  87. {name: '内蒙古',value: Math.round(Math.random()*2000)},
  88. {name: '陕西',value: Math.round(Math.random()*2000)},
  89. {name: '吉林',value: Math.round(Math.random()*2000)},
  90. {name: '福建',value: Math.round(Math.random()*2000)},
  91. {name: '贵州',value: Math.round(Math.random()*2000)},
  92. {name: '广东',value: Math.round(Math.random()*2000)},
  93. {name: '青海',value: Math.round(Math.random()*2000)},
  94. {name: '西藏',value: Math.round(Math.random()*2000)},
  95. {name: '四川',value: Math.round(Math.random()*2000)},
  96. {name: '宁夏',value: Math.round(Math.random()*2000)},
  97. {name: '海南',value: Math.round(Math.random()*2000)},
  98. {name: '台湾',value: Math.round(Math.random()*2000)},
  99. {name: '香港',value: Math.round(Math.random()*2000)},
  100. {name: '澳门',value: Math.round(Math.random()*2000)}
  101. ],
  102. itemStyle: {
  103. emphasis: {
  104. shadowBlur: 10,
  105. shadowOffsetX: 0,
  106. shadowColor: 'rgba(0, 0, 0, 0.5)'
  107. }
  108. }
  109. }
  110. ]
  111. };
  112. myChart.setOption(option);
  113. }
  114. );
  115. }
  116. //根据左边地图选择省份传入数据显示右边的饼图
  117. function echartsrmapt(data1,data2){
  118. require(
  119. [
  120. 'echarts',
  121. 'echarts/chart/line',
  122. 'echarts/chart/bar',
  123. 'echarts/chart/scatter',
  124. 'echarts/chart/k',
  125. 'echarts/chart/pie',
  126. 'echarts/chart/radar',
  127. 'echarts/chart/force',
  128. 'echarts/chart/chord',
  129. 'echarts/chart/gauge',
  130. 'echarts/chart/funnel',
  131. 'echarts/chart/eventRiver',
  132. 'echarts/chart/venn',
  133. 'echarts/chart/treemap',
  134. 'echarts/chart/tree',
  135. 'echarts/chart/wordCloud',
  136. 'echarts/chart/heatmap',
  137. 'echarts/chart/map'
  138. ],
  139. function (ec) {
  140. var myChart = ec.init(document.getElementById('rmap'));
  141. var option = {
  142. title : {
  143. text: '',
  144. subtext: '',
  145. x:'center'
  146. },
  147. tooltip : {
  148. trigger: 'item',
  149. formatter: "{a} <br/>{b} : {c} ({d}%)"
  150. },
  151. toolbox: {
  152. feature: {
  153. saveAsImage: {},
  154. restore: {},
  155. dataView: {}
  156. }
  157. },
  158. legend: {
  159. orient: 'vertical',
  160. x: 'left',
  161. data: data1
  162. },
  163. series : [
  164. {
  165. name: '所占比例',
  166. type: 'pie',
  167. radius : '55%',
  168. center: ['50%', '60%'],
  169. data:data2,
  170. itemStyle: {
  171. emphasis: {
  172. shadowBlur: 10,
  173. shadowOffsetX: 0,
  174. shadowColor: 'rgba(0, 0, 0, 0.5)'
  175. }
  176. }
  177. }
  178. ]
  179. };
  180. myChart.setOption(option);
  181. }
  182. );
  183. }
  184. //加载中国地图
  185. function echartsChina(){
  186. require(
  187. [
  188. 'echarts',
  189. 'echarts/chart/wordCloud',
  190. 'echarts/chart/map'// 按需加载所需图表,如需动态类型切换功能,别忘了同时加载相应图表
  191. ],
  192. function (ec) {
  193. var myChart = ec.init(document.getElementById('china-map'));
  194. var ecConfig = require('echarts/config');
  195. var zrEvent = require('zrender/tool/event');
  196. //var myChart = echarts.init(document.getElementById('china-map'));
  197. var curIndx = 0;
  198. var mapType = [
  199. 'china',
  200. // 23个省
  201. '广东', '青海', '四川', '海南', '陕西',
  202. '甘肃', '云南', '湖南', '湖北', '黑龙江',
  203. '贵州', '山东', '江西', '河南', '河北',
  204. '山西', '安徽', '福建', '浙江', '江苏',
  205. '吉林', '辽宁', '台湾',
  206. // 5个自治区
  207. '新疆', '广西', '宁夏', '内蒙古', '西藏',
  208. // 4个直辖市
  209. '北京', '天津', '上海', '重庆',
  210. // 2个特别行政区
  211. '香港', '澳门'
  212. ];
  213. document.getElementById('china-map').onmousewheel = function (e){
  214. return false; //这个方法我取消了滑动切换地图
  215. var event = e || window.event;
  216. curIndx += zrEvent.getDelta(event) > 0 ? (-1) : 1;
  217. if (curIndx < 0) {
  218. curIndx = mapType.length - 1;
  219. }
  220. var mt = mapType[curIndx % mapType.length];
  221. if (mt == 'china') {
  222. option.tooltip.formatter = '滑动鼠标或点击进入该省<br/>{b}';
  223. }
  224. else{
  225. option.tooltip.formatter = '滑动鼠标或点击返回全国<br/>{b}';
  226. }
  227. option.series[0].mapType = mt;
  228. option.title.subtext = mt + ' (滑动鼠标或点击切换)';
  229. myChart.setOption(option, true);
  230. zrEvent.stop(event);
  231. };
  232. //下面这个是选择省份触发的事件
  233. myChart.on(ecConfig.EVENT.MAP_SELECTED, function (param){
  234. alert("选择省份触发的事件");
  235. var len = mapType.length;
  236. var mt = mapType[curIndx % len];
  237. if (mt == 'china') {
  238. // 全国选择时指定到选中的省份
  239. var selected = param.selected;
  240. /* var mapSeries = option.series[0];
  241. var data = [];
  242. var legendData = [];
  243. var name;
  244. var datat =[];
  245. for (var p = 0, len = mapSeries.data.length; p < len; p++) {
  246. name = mapSeries.data[p].name;
  247. //mapSeries.data[p].selected = selected[name];
  248. parentid = mapSeries.data[p].parentid;
  249. if(parentid=='2'){
  250. data.push({
  251. name: name,
  252. parentid:parentid,
  253. value: mapSeries.data[p].value
  254. });
  255. datat.push({
  256. name: name
  257. });
  258. echartsrmapt(datat,data);
  259. legendData.push(name);
  260. }
  261. } */
  262. for (var i in selected) {
  263. if (selected[i]) {
  264. mt = i;
  265. while (len--) {
  266. if (mapType[len] == mt) {
  267. curIndx = len;
  268. }
  269. }
  270. break;
  271. }
  272. }
  273. option.tooltip.formatter = '点击返回全国<br/>{b}';
  274. }
  275. else {
  276. curIndx = 0;
  277. mt = 'china';
  278. option.tooltip.formatter = '点击进入该省<br/>{b}';
  279. }
  280. option.series[0].mapType = mt;
  281. option.title.subtext = mt + ' (点击切换)';
  282. myChart.setOption(option, true);
  283. });
  284. //这是选择省份的点击事件
  285. myChart.on(ecConfig.EVENT.CLICK, function (param){
  286. alert("点击省份触发的事件");
  287. var len = mapType.length;
  288. var mt = mapType[curIndx % len];
  289. if (mt == '河南') {
  290. // 全国选择时指定到选中的省份
  291. var selected = param.selected;
  292. var mapSeries = option.series[0];
  293. var data = [];
  294. var legendData = [];
  295. var name;
  296. var datat =[];
  297. for (var p = 0, len = mapSeries.data.length; p < len; p++) {
  298. name = mapSeries.data[p].name;
  299. //mapSeries.data[p].selected = selected[name];
  300. parentid = mapSeries.data[p].parentid;
  301. if(parentid=='2'){
  302. data.push({
  303. name: name,
  304. parentid:parentid,
  305. value: mapSeries.data[p].value
  306. });
  307. datat.push({
  308. name: name
  309. });
  310. echartsrmapt(datat,data);
  311. legendData.push(name);
  312. }
  313. }
  314. }else{
  315. echartsrmap();
  316. }
  317. });
  318. var option = {
  319. title: {
  320. text : '全国34个省市自治区',
  321. subtext : 'china (点击切换)'
  322. },
  323. tooltip : {
  324. trigger: 'item',
  325. formatter: '点击进入该省<br/>{b}'
  326. },
  327. legend: {
  328. orient: 'vertical',
  329. x:'right',
  330. data:['随机数据']
  331. },
  332. dataRange: {
  333. min: 0,
  334. max: 1000,
  335. color:['orange','yellow'],
  336. text:['高','低'], // 文本,默认为数值文本
  337. calculable : true
  338. },
  339. series : [
  340. {
  341. name: '随机数据',
  342. type: 'map',
  343. mapType: 'china',
  344. selectedMode : 'single',
  345. itemStyle:{
  346. normal:{label:{show:true}},
  347. emphasis:{label:{show:true}}
  348. },
  349. data:[
  350. {name: '重庆市',parentid:'1',value: Math.round(Math.random()*1000)},
  351. {name: '北京市',parentid:'1',value: Math.round(Math.random()*1000)},
  352. {name: '天津市',parentid:'1',value: Math.round(Math.random()*1000)},
  353. {name: '上海市',parentid:'1',value: Math.round(Math.random()*1000)},
  354. {name: '香港',parentid:'1',value: Math.round(Math.random()*1000)},
  355. {name: '澳门',parentid:'1',value: Math.round(Math.random()*1000)},
  356. {name: '巴音郭楞蒙古自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  357. {name: '和田地区',parentid:'1',value: Math.round(Math.random()*1000)},
  358. {name: '哈密地区',parentid:'1',value: Math.round(Math.random()*1000)},
  359. {name: '阿克苏地区',parentid:'1',value: Math.round(Math.random()*1000)},
  360. {name: '阿勒泰地区',parentid:'1',value: Math.round(Math.random()*1000)},
  361. {name: '喀什地区',parentid:'1',value: Math.round(Math.random()*1000)},
  362. {name: '塔城地区',parentid:'1',value: Math.round(Math.random()*1000)},
  363. {name: '昌吉回族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  364. {name: '克孜勒苏柯尔克孜自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  365. {name: '吐鲁番地区',parentid:'1',value: Math.round(Math.random()*1000)},
  366. {name: '伊犁哈萨克自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  367. {name: '博尔塔拉蒙古自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  368. {name: '乌鲁木齐市',parentid:'1',value: Math.round(Math.random()*1000)},
  369. {name: '克拉玛依市',parentid:'1',value: Math.round(Math.random()*1000)},
  370. {name: '阿拉尔市',parentid:'1',value: Math.round(Math.random()*1000)},
  371. {name: '图木舒克市',parentid:'1',value: Math.round(Math.random()*1000)},
  372. {name: '五家渠市',parentid:'1',value: Math.round(Math.random()*1000)},
  373. {name: '石河子市',parentid:'1',value: Math.round(Math.random()*1000)},
  374. {name: '那曲地区',parentid:'1',value: Math.round(Math.random()*1000)},
  375. {name: '阿里地区',parentid:'1',value: Math.round(Math.random()*1000)},
  376. {name: '日喀则地区',parentid:'1',value: Math.round(Math.random()*1000)},
  377. {name: '林芝地区',parentid:'1',value: Math.round(Math.random()*1000)},
  378. {name: '昌都地区',parentid:'1',value: Math.round(Math.random()*1000)},
  379. {name: '山南地区',parentid:'1',value: Math.round(Math.random()*1000)},
  380. {name: '拉萨市',parentid:'1',value: Math.round(Math.random()*1000)},
  381. {name: '呼伦贝尔市',parentid:'1',value: Math.round(Math.random()*1000)},
  382. {name: '阿拉善盟',parentid:'1',value: Math.round(Math.random()*1000)},
  383. {name: '锡林郭勒盟',parentid:'1',value: Math.round(Math.random()*1000)},
  384. {name: '鄂尔多斯市',parentid:'1',value: Math.round(Math.random()*1000)},
  385. {name: '赤峰市',parentid:'1',value: Math.round(Math.random()*1000)},
  386. {name: '巴彦淖尔市',parentid:'1',value: Math.round(Math.random()*1000)},
  387. {name: '通辽市',parentid:'1',value: Math.round(Math.random()*1000)},
  388. {name: '乌兰察布市',parentid:'1',value: Math.round(Math.random()*1000)},
  389. {name: '兴安盟',parentid:'1',value: Math.round(Math.random()*1000)},
  390. {name: '包头市',parentid:'1',value: Math.round(Math.random()*1000)},
  391. {name: '呼和浩特市',parentid:'1',value: Math.round(Math.random()*1000)},
  392. {name: '乌海市',parentid:'1',value: Math.round(Math.random()*1000)},
  393. {name: '海西蒙古族藏族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  394. {name: '玉树藏族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  395. {name: '果洛藏族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  396. {name: '海南藏族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  397. {name: '海北藏族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  398. {name: '黄南藏族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  399. {name: '海东地区',parentid:'1',value: Math.round(Math.random()*1000)},
  400. {name: '西宁市',parentid:'1',value: Math.round(Math.random()*1000)},
  401. {name: '甘孜藏族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  402. {name: '阿坝藏族羌族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  403. {name: '凉山彝族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  404. {name: '绵阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  405. {name: '达州市',parentid:'1',value: Math.round(Math.random()*1000)},
  406. {name: '广元市',parentid:'1',value: Math.round(Math.random()*1000)},
  407. {name: '雅安市',parentid:'1',value: Math.round(Math.random()*1000)},
  408. {name: '宜宾市',parentid:'1',value: Math.round(Math.random()*1000)},
  409. {name: '乐山市',parentid:'1',value: Math.round(Math.random()*1000)},
  410. {name: '南充市',parentid:'1',value: Math.round(Math.random()*1000)},
  411. {name: '巴中市',parentid:'1',value: Math.round(Math.random()*1000)},
  412. {name: '泸州市',parentid:'1',value: Math.round(Math.random()*1000)},
  413. {name: '成都市',parentid:'1',value: Math.round(Math.random()*1000)},
  414. {name: '资阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  415. {name: '攀枝花市',parentid:'1',value: Math.round(Math.random()*1000)},
  416. {name: '眉山市',parentid:'1',value: Math.round(Math.random()*1000)},
  417. {name: '广安市',parentid:'1',value: Math.round(Math.random()*1000)},
  418. {name: '德阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  419. {name: '内江市',parentid:'1',value: Math.round(Math.random()*1000)},
  420. {name: '遂宁市',parentid:'1',value: Math.round(Math.random()*1000)},
  421. {name: '自贡市',parentid:'1',value: Math.round(Math.random()*1000)},
  422. {name: '黑河市',parentid:'1',value: Math.round(Math.random()*1000)},
  423. {name: '大兴安岭地区',parentid:'1',value: Math.round(Math.random()*1000)},
  424. {name: '哈尔滨市',parentid:'1',value: Math.round(Math.random()*1000)},
  425. {name: '齐齐哈尔市',parentid:'1',value: Math.round(Math.random()*1000)},
  426. {name: '牡丹江市',parentid:'1',value: Math.round(Math.random()*1000)},
  427. {name: '绥化市',parentid:'1',value: Math.round(Math.random()*1000)},
  428. {name: '伊春市',parentid:'1',value: Math.round(Math.random()*1000)},
  429. {name: '佳木斯市',parentid:'1',value: Math.round(Math.random()*1000)},
  430. {name: '鸡西市',parentid:'1',value: Math.round(Math.random()*1000)},
  431. {name: '双鸭山市',parentid:'1',value: Math.round(Math.random()*1000)},
  432. {name: '大庆市',parentid:'1',value: Math.round(Math.random()*1000)},
  433. {name: '鹤岗市',parentid:'1',value: Math.round(Math.random()*1000)},
  434. {name: '七台河市',parentid:'1',value: Math.round(Math.random()*1000)},
  435. {name: '酒泉市',parentid:'1',value: Math.round(Math.random()*1000)},
  436. {name: '张掖市',parentid:'1',value: Math.round(Math.random()*1000)},
  437. {name: '甘南藏族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  438. {name: '武威市',parentid:'1',value: Math.round(Math.random()*1000)},
  439. {name: '陇南市',parentid:'1',value: Math.round(Math.random()*1000)},
  440. {name: '庆阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  441. {name: '白银市',parentid:'1',value: Math.round(Math.random()*1000)},
  442. {name: '定西市',parentid:'1',value: Math.round(Math.random()*1000)},
  443. {name: '天水市',parentid:'1',value: Math.round(Math.random()*1000)},
  444. {name: '兰州市',parentid:'1',value: Math.round(Math.random()*1000)},
  445. {name: '平凉市',parentid:'1',value: Math.round(Math.random()*1000)},
  446. {name: '临夏回族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  447. {name: '金昌市',parentid:'1',value: Math.round(Math.random()*1000)},
  448. {name: '嘉峪关市',parentid:'1',value: Math.round(Math.random()*1000)},
  449. {name: '普洱市',parentid:'1',value: Math.round(Math.random()*1000)},
  450. {name: '红河哈尼族彝族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  451. {name: '文山壮族苗族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  452. {name: '曲靖市',parentid:'1',value: Math.round(Math.random()*1000)},
  453. {name: '楚雄彝族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  454. {name: '大理白族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  455. {name: '临沧市',parentid:'1',value: Math.round(Math.random()*1000)},
  456. {name: '迪庆藏族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  457. {name: '昭通市',parentid:'1',value: Math.round(Math.random()*1000)},
  458. {name: '昆明市',parentid:'1',value: Math.round(Math.random()*1000)},
  459. {name: '丽江市',parentid:'1',value: Math.round(Math.random()*1000)},
  460. {name: '西双版纳傣族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  461. {name: '保山市',parentid:'1',value: Math.round(Math.random()*1000)},
  462. {name: '玉溪市',parentid:'1',value: Math.round(Math.random()*1000)},
  463. {name: '怒江傈僳族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  464. {name: '德宏傣族景颇族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  465. {name: '百色市',parentid:'1',value: Math.round(Math.random()*1000)},
  466. {name: '河池市',parentid:'1',value: Math.round(Math.random()*1000)},
  467. {name: '桂林市',parentid:'1',value: Math.round(Math.random()*1000)},
  468. {name: '南宁市',parentid:'1',value: Math.round(Math.random()*1000)},
  469. {name: '柳州市',parentid:'1',value: Math.round(Math.random()*1000)},
  470. {name: '崇左市',parentid:'1',value: Math.round(Math.random()*1000)},
  471. {name: '来宾市',parentid:'1',value: Math.round(Math.random()*1000)},
  472. {name: '玉林市',parentid:'1',value: Math.round(Math.random()*1000)},
  473. {name: '梧州市',parentid:'1',value: Math.round(Math.random()*1000)},
  474. {name: '贺州市',parentid:'1',value: Math.round(Math.random()*1000)},
  475. {name: '钦州市',parentid:'1',value: Math.round(Math.random()*1000)},
  476. {name: '贵港市',parentid:'1',value: Math.round(Math.random()*1000)},
  477. {name: '防城港市',parentid:'1',value: Math.round(Math.random()*1000)},
  478. {name: '北海市',parentid:'1',value: Math.round(Math.random()*1000)},
  479. {name: '怀化市',parentid:'1',value: Math.round(Math.random()*1000)},
  480. {name: '永州市',parentid:'1',value: Math.round(Math.random()*1000)},
  481. {name: '邵阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  482. {name: '郴州市',parentid:'1',value: Math.round(Math.random()*1000)},
  483. {name: '常德市',parentid:'1',value: Math.round(Math.random()*1000)},
  484. {name: '湘西土家族苗族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  485. {name: '衡阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  486. {name: '岳阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  487. {name: '益阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  488. {name: '长沙市',parentid:'1',value: Math.round(Math.random()*1000)},
  489. {name: '株洲市',parentid:'1',value: Math.round(Math.random()*1000)},
  490. {name: '张家界市',parentid:'1',value: Math.round(Math.random()*1000)},
  491. {name: '娄底市',parentid:'1',value: Math.round(Math.random()*1000)},
  492. {name: '湘潭市',parentid:'1',value: Math.round(Math.random()*1000)},
  493. {name: '榆林市',parentid:'1',value: Math.round(Math.random()*1000)},
  494. {name: '延安市',parentid:'1',value: Math.round(Math.random()*1000)},
  495. {name: '汉中市',parentid:'1',value: Math.round(Math.random()*1000)},
  496. {name: '安康市',parentid:'1',value: Math.round(Math.random()*1000)},
  497. {name: '商洛市',parentid:'1',value: Math.round(Math.random()*1000)},
  498. {name: '宝鸡市',parentid:'1',value: Math.round(Math.random()*1000)},
  499. {name: '渭南市',parentid:'1',value: Math.round(Math.random()*1000)},
  500. {name: '咸阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  501. {name: '西安市',parentid:'1',value: Math.round(Math.random()*1000)},
  502. {name: '铜川市',parentid:'1',value: Math.round(Math.random()*1000)},
  503. {name: '清远市',parentid:'1',value: Math.round(Math.random()*1000)},
  504. {name: '韶关市',parentid:'1',value: Math.round(Math.random()*1000)},
  505. {name: '湛江市',parentid:'1',value: Math.round(Math.random()*1000)},
  506. {name: '梅州市',parentid:'1',value: Math.round(Math.random()*1000)},
  507. {name: '河源市',parentid:'1',value: Math.round(Math.random()*1000)},
  508. {name: '肇庆市',parentid:'1',value: Math.round(Math.random()*1000)},
  509. {name: '惠州市',parentid:'1',value: Math.round(Math.random()*1000)},
  510. {name: '茂名市',parentid:'1',value: Math.round(Math.random()*1000)},
  511. {name: '江门市',parentid:'1',value: Math.round(Math.random()*1000)},
  512. {name: '阳江市',parentid:'1',value: Math.round(Math.random()*1000)},
  513. {name: '云浮市',parentid:'1',value: Math.round(Math.random()*1000)},
  514. {name: '广州市',parentid:'1',value: Math.round(Math.random()*1000)},
  515. {name: '汕尾市',parentid:'1',value: Math.round(Math.random()*1000)},
  516. {name: '揭阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  517. {name: '珠海市',parentid:'1',value: Math.round(Math.random()*1000)},
  518. {name: '佛山市',parentid:'1',value: Math.round(Math.random()*1000)},
  519. {name: '潮州市',parentid:'1',value: Math.round(Math.random()*1000)},
  520. {name: '汕头市',parentid:'1',value: Math.round(Math.random()*1000)},
  521. {name: '深圳市',parentid:'1',value: Math.round(Math.random()*1000)},
  522. {name: '东莞市',parentid:'1',value: Math.round(Math.random()*1000)},
  523. {name: '中山市',parentid:'1',value: Math.round(Math.random()*1000)},
  524. {name: '延边朝鲜族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  525. {name: '吉林市',parentid:'1',value: Math.round(Math.random()*1000)},
  526. {name: '白城市',parentid:'1',value: Math.round(Math.random()*1000)},
  527. {name: '松原市',parentid:'1',value: Math.round(Math.random()*1000)},
  528. {name: '长春市',parentid:'1',value: Math.round(Math.random()*1000)},
  529. {name: '白山市',parentid:'1',value: Math.round(Math.random()*1000)},
  530. {name: '通化市',parentid:'1',value: Math.round(Math.random()*1000)},
  531. {name: '四平市',parentid:'1',value: Math.round(Math.random()*1000)},
  532. {name: '辽源市',parentid:'1',value: Math.round(Math.random()*1000)},
  533. {name: '承德市',parentid:'1',value: Math.round(Math.random()*1000)},
  534. {name: '张家口市',parentid:'1',value: Math.round(Math.random()*1000)},
  535. {name: '保定市',parentid:'1',value: Math.round(Math.random()*1000)},
  536. {name: '唐山市',parentid:'1',value: Math.round(Math.random()*1000)},
  537. {name: '沧州市',parentid:'1',value: Math.round(Math.random()*1000)},
  538. {name: '石家庄市',parentid:'1',value: Math.round(Math.random()*1000)},
  539. {name: '邢台市',parentid:'1',value: Math.round(Math.random()*1000)},
  540. {name: '邯郸市',parentid:'1',value: Math.round(Math.random()*1000)},
  541. {name: '秦皇岛市',parentid:'1',value: Math.round(Math.random()*1000)},
  542. {name: '衡水市',parentid:'1',value: Math.round(Math.random()*1000)},
  543. {name: '廊坊市',parentid:'1',value: Math.round(Math.random()*1000)},
  544. {name: '恩施土家族苗族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  545. {name: '十堰市',parentid:'1',value: Math.round(Math.random()*1000)},
  546. {name: '宜昌市',parentid:'1',value: Math.round(Math.random()*1000)},
  547. {name: '襄樊市',parentid:'1',value: Math.round(Math.random()*1000)},
  548. {name: '黄冈市',parentid:'1',value: Math.round(Math.random()*1000)},
  549. {name: '荆州市',parentid:'1',value: Math.round(Math.random()*1000)},
  550. {name: '荆门市',parentid:'1',value: Math.round(Math.random()*1000)},
  551. {name: '咸宁市',parentid:'1',value: Math.round(Math.random()*1000)},
  552. {name: '随州市',parentid:'1',value: Math.round(Math.random()*1000)},
  553. {name: '孝感市',parentid:'1',value: Math.round(Math.random()*1000)},
  554. {name: '武汉市',parentid:'1',value: Math.round(Math.random()*1000)},
  555. {name: '黄石市',parentid:'1',value: Math.round(Math.random()*1000)},
  556. {name: '神农架林区',parentid:'1',value: Math.round(Math.random()*1000)},
  557. {name: '天门市',parentid:'1',value: Math.round(Math.random()*1000)},
  558. {name: '仙桃市',parentid:'1',value: Math.round(Math.random()*1000)},
  559. {name: '潜江市',parentid:'1',value: Math.round(Math.random()*1000)},
  560. {name: '鄂州市',parentid:'1',value: Math.round(Math.random()*1000)},
  561. {name: '遵义市',parentid:'1',value: Math.round(Math.random()*1000)},
  562. {name: '黔东南苗族侗族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  563. {name: '毕节地区',parentid:'1',value: Math.round(Math.random()*1000)},
  564. {name: '黔南布依族苗族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  565. {name: '铜仁地区',parentid:'1',value: Math.round(Math.random()*1000)},
  566. {name: '黔西南布依族苗族自治州',parentid:'1',value: Math.round(Math.random()*1000)},
  567. {name: '六盘水市',parentid:'1',value: Math.round(Math.random()*1000)},
  568. {name: '安顺市',parentid:'1',value: Math.round(Math.random()*1000)},
  569. {name: '贵阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  570. {name: '烟台市',parentid:'1',value: Math.round(Math.random()*1000)},
  571. {name: '临沂市',parentid:'1',value: Math.round(Math.random()*1000)},
  572. {name: '潍坊市',parentid:'1',value: Math.round(Math.random()*1000)},
  573. {name: '青岛市',parentid:'1',value: Math.round(Math.random()*1000)},
  574. {name: '菏泽市',parentid:'1',value: Math.round(Math.random()*1000)},
  575. {name: '济宁市',parentid:'1',value: Math.round(Math.random()*1000)},
  576. {name: '德州市',parentid:'1',value: Math.round(Math.random()*1000)},
  577. {name: '滨州市',parentid:'1',value: Math.round(Math.random()*1000)},
  578. {name: '聊城市',parentid:'1',value: Math.round(Math.random()*1000)},
  579. {name: '东营市',parentid:'1',value: Math.round(Math.random()*1000)},
  580. {name: '济南市',parentid:'1',value: Math.round(Math.random()*1000)},
  581. {name: '泰安市',parentid:'1',value: Math.round(Math.random()*1000)},
  582. {name: '威海市',parentid:'1',value: Math.round(Math.random()*1000)},
  583. {name: '日照市',parentid:'1',value: Math.round(Math.random()*1000)},
  584. {name: '淄博市',parentid:'1',value: Math.round(Math.random()*1000)},
  585. {name: '枣庄市',parentid:'1',value: Math.round(Math.random()*1000)},
  586. {name: '莱芜市',parentid:'1',value: Math.round(Math.random()*1000)},
  587. {name: '赣州市',parentid:'1',value: Math.round(Math.random()*1000)},
  588. {name: '吉安市',parentid:'1',value: Math.round(Math.random()*1000)},
  589. {name: '上饶市',parentid:'1',value: Math.round(Math.random()*1000)},
  590. {name: '九江市',parentid:'1',value: Math.round(Math.random()*1000)},
  591. {name: '抚州市',parentid:'1',value: Math.round(Math.random()*1000)},
  592. {name: '宜春市',parentid:'1',value: Math.round(Math.random()*1000)},
  593. {name: '南昌市',parentid:'1',value: Math.round(Math.random()*1000)},
  594. {name: '景德镇市',parentid:'1',value: Math.round(Math.random()*1000)},
  595. {name: '萍乡市',parentid:'1',value: Math.round(Math.random()*1000)},
  596. {name: '鹰潭市',parentid:'1',value: Math.round(Math.random()*1000)},
  597. {name: '新余市',parentid:'1',value: Math.round(Math.random()*1000)},
  598. {name: '南阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  599. {name: '信阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  600. {name: '洛阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  601. {name: '驻马店市',parentid:'1',value: Math.round(Math.random()*1000)},
  602. {name: '周口市',parentid:'1',value: Math.round(Math.random()*1000)},
  603. {name: '商丘市',parentid:'1',value: Math.round(Math.random()*1000)},
  604. {name: '三门峡市',parentid:'1',value: Math.round(Math.random()*1000)},
  605. {name: '新乡市',parentid:'1',value: Math.round(Math.random()*1000)},
  606. {name: '平顶山市',parentid:'1',value: Math.round(Math.random()*1000)},
  607. {name: '郑州市',parentid:'2',value: Math.round(Math.random()*1000)},
  608. {name: '安阳市',parentid:'2',value: Math.round(Math.random()*1000)},
  609. {name: '开封市',parentid:'2',value: Math.round(Math.random()*1000)},
  610. {name: '焦作市',parentid:'1',value: Math.round(Math.random()*1000)},
  611. {name: '许昌市',parentid:'1',value: Math.round(Math.random()*1000)},
  612. {name: '濮阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  613. {name: '漯河市',parentid:'1',value: Math.round(Math.random()*1000)},
  614. {name: '鹤壁市',parentid:'1',value: Math.round(Math.random()*1000)},
  615. {name: '大连市',parentid:'1',value: Math.round(Math.random()*1000)},
  616. {name: '朝阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  617. {name: '丹东市',parentid:'1',value: Math.round(Math.random()*1000)},
  618. {name: '铁岭市',parentid:'1',value: Math.round(Math.random()*1000)},
  619. {name: '沈阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  620. {name: '抚顺市',parentid:'1',value: Math.round(Math.random()*1000)},
  621. {name: '葫芦岛市',parentid:'1',value: Math.round(Math.random()*1000)},
  622. {name: '阜新市',parentid:'1',value: Math.round(Math.random()*1000)},
  623. {name: '锦州市',parentid:'1',value: Math.round(Math.random()*1000)},
  624. {name: '鞍山市',parentid:'1',value: Math.round(Math.random()*1000)},
  625. {name: '本溪市',parentid:'1',value: Math.round(Math.random()*1000)},
  626. {name: '营口市',parentid:'1',value: Math.round(Math.random()*1000)},
  627. {name: '辽阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  628. {name: '盘锦市',parentid:'1',value: Math.round(Math.random()*1000)},
  629. {name: '忻州市',parentid:'1',value: Math.round(Math.random()*1000)},
  630. {name: '吕梁市',parentid:'1',value: Math.round(Math.random()*1000)},
  631. {name: '临汾市',parentid:'1',value: Math.round(Math.random()*1000)},
  632. {name: '晋中市',parentid:'1',value: Math.round(Math.random()*1000)},
  633. {name: '运城市',parentid:'1',value: Math.round(Math.random()*1000)},
  634. {name: '大同市',parentid:'1',value: Math.round(Math.random()*1000)},
  635. {name: '长治市',parentid:'1',value: Math.round(Math.random()*1000)},
  636. {name: '朔州市',parentid:'1',value: Math.round(Math.random()*1000)},
  637. {name: '晋城市',parentid:'1',value: Math.round(Math.random()*1000)},
  638. {name: '太原市',parentid:'1',value: Math.round(Math.random()*1000)},
  639. {name: '阳泉市',parentid:'1',value: Math.round(Math.random()*1000)},
  640. {name: '六安市',parentid:'1',value: Math.round(Math.random()*1000)},
  641. {name: '安庆市',parentid:'1',value: Math.round(Math.random()*1000)},
  642. {name: '滁州市',parentid:'1',value: Math.round(Math.random()*1000)},
  643. {name: '宣城市',parentid:'1',value: Math.round(Math.random()*1000)},
  644. {name: '阜阳市',parentid:'1',value: Math.round(Math.random()*1000)},
  645. {name: '宿州市',parentid:'1',value: Math.round(Math.random()*1000)},
  646. {name: '黄山市',parentid:'1',value: Math.round(Math.random()*1000)},
  647. {name: '巢湖市',parentid:'1',value: Math.round(Math.random()*1000)},
  648. {name: '亳州市',parentid:'1',value: Math.round(Math.random()*1000)},
  649. {name: '池州市',parentid:'1',value: Math.round(Math.random()*1000)},
  650. {name: '合肥市',parentid:'1',value: Math.round(Math.random()*1000)},
  651. {name: '蚌埠市',parentid:'1',value: Math.round(Math.random()*1000)},
  652. {name: '芜湖市',parentid:'1',value: Math.round(Math.random()*1000)},
  653. {name: '淮北市',parentid:'1',value: Math.round(Math.random()*1000)},
  654. {name: '淮南市',parentid:'1',value: Math.round(Math.random()*1000)},
  655. {name: '马鞍山市',parentid:'1',value: Math.round(Math.random()*1000)},
  656. {name: '铜陵市',parentid:'1',value: Math.round(Math.random()*1000)},
  657. {name: '南平市',parentid:'1',value: Math.round(Math.random()*1000)},
  658. {name: '三明市',parentid:'1',value: Math.round(Math.random()*1000)},
  659. {name: '龙岩市',parentid:'1',value: Math.round(Math.random()*1000)},
  660. {name: '宁德市',parentid:'1',value: Math.round(Math.random()*1000)},
  661. {name: '福州市',parentid:'1',value: Math.round(Math.random()*1000)},
  662. {name: '漳州市',parentid:'1',value: Math.round(Math.random()*1000)},
  663. {name: '泉州市',parentid:'1',value: Math.round(Math.random()*1000)},
  664. {name: '莆田市',parentid:'1',value: Math.round(Math.random()*1000)},
  665. {name: '厦门市',parentid:'1',value: Math.round(Math.random()*1000)},
  666. {name: '丽水市',parentid:'1',value: Math.round(Math.random()*1000)},
  667. {name: '杭州市',parentid:'1',value: Math.round(Math.random()*1000)},
  668. {name: '温州市',parentid:'1',value: Math.round(Math.random()*1000)},
  669. {name: '宁波市',parentid:'1',value: Math.round(Math.random()*1000)},
  670. {name: '舟山市',parentid:'1',value: Math.round(Math.random()*1000)},
  671. {name: '台州市',parentid:'1',value: Math.round(Math.random()*1000)},
  672. {name: '金华市',parentid:'1',value: Math.round(Math.random()*1000)},
  673. {name: '衢州市',parentid:'1',value: Math.round(Math.random()*1000)},
  674. {name: '绍兴市',parentid:'1',value: Math.round(Math.random()*1000)},
  675. {name: '嘉兴市',parentid:'1',value: Math.round(Math.random()*1000)},
  676. {name: '湖州市',parentid:'1',value: Math.round(Math.random()*1000)},
  677. {name: '盐城市',parentid:'1',value: Math.round(Math.random()*1000)},
  678. {name: '徐州市',parentid:'1',value: Math.round(Math.random()*1000)},
  679. {name: '南通市',parentid:'1',value: Math.round(Math.random()*1000)},
  680. {name: '淮安市',parentid:'1',value: Math.round(Math.random()*1000)},
  681. {name: '苏州市',parentid:'1',value: Math.round(Math.random()*1000)},
  682. {name: '宿迁市',parentid:'1',value: Math.round(Math.random()*1000)},
  683. {name: '连云港市',parentid:'1',value: Math.round(Math.random()*1000)},
  684. {name: '扬州市',parentid:'1',value: Math.round(Math.random()*1000)},
  685. {name: '南京市',parentid:'1',value: Math.round(Math.random()*1000)},
  686. {name: '泰州市',parentid:'1',value: Math.round(Math.random()*1000)},
  687. {name: '无锡市',parentid:'1',value: Math.round(Math.random()*1000)},
  688. {name: '常州市',parentid:'1',value: Math.round(Math.random()*1000)},
  689. {name: '镇江市',parentid:'1',value: Math.round(Math.random()*1000)},
  690. {name: '吴忠市',parentid:'1',value: Math.round(Math.random()*1000)},
  691. {name: '中卫市',parentid:'1',value: Math.round(Math.random()*1000)},
  692. {name: '固原市',parentid:'1',value: Math.round(Math.random()*1000)},
  693. {name: '银川市',parentid:'1',value: Math.round(Math.random()*1000)},
  694. {name: '石嘴山市',parentid:'1',value: Math.round(Math.random()*1000)},
  695. {name: '儋州市',parentid:'1',value: Math.round(Math.random()*1000)},
  696. {name: '文昌市',parentid:'1',value: Math.round(Math.random()*1000)},
  697. {name: '乐东黎族自治县',parentid:'1',value: Math.round(Math.random()*1000)},
  698. {name: '三亚市',parentid:'1',value: Math.round(Math.random()*1000)},
  699. {name: '琼中黎族苗族自治县',parentid:'1',value: Math.round(Math.random()*1000)},
  700. {name: '东方市',parentid:'1',value: Math.round(Math.random()*1000)},
  701. {name: '海口市',parentid:'1',value: Math.round(Math.random()*1000)},
  702. {name: '万宁市',parentid:'1',value: Math.round(Math.random()*1000)},
  703. {name: '澄迈县',parentid:'1',value: Math.round(Math.random()*1000)},
  704. {name: '白沙黎族自治县',parentid:'1',value: Math.round(Math.random()*1000)},
  705. {name: '琼海市',parentid:'1',value: Math.round(Math.random()*1000)},
  706. {name: '昌江黎族自治县',parentid:'1',value: Math.round(Math.random()*1000)},
  707. {name: '临高县',parentid:'1',value: Math.round(Math.random()*1000)},
  708. {name: '陵水黎族自治县',parentid:'1',value: Math.round(Math.random()*1000)},
  709. {name: '屯昌县',parentid:'1',value: Math.round(Math.random()*1000)},
  710. {name: '定安县',parentid:'1',value: Math.round(Math.random()*1000)},
  711. {name: '保亭黎族苗族自治县',parentid:'1',value: Math.round(Math.random()*1000)},
  712. {name: '五指山市',parentid:'1',value: Math.round(Math.random()*1000)}
  713. ]
  714. }
  715. ]
  716. };
  717. myChart.setOption(option);
  718. myChart.on('mouseover', function (params) {
  719. var dataIndex = params.dataIndex;
  720. console.log(params);
  721. });
  722. }
  723. );
  724. }
  725. </script>

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/110057?site
推荐阅读