echarts.js 72 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944
  1. $(function () {
  2. /*ceshis();*/
  3. ceshis1();
  4. ceshis2();
  5. ceshis3();
  6. ceshis4();
  7. ceshis5();
  8. function ceshis1() {
  9. var myChart = echarts.init(document.getElementById('chart2'));
  10. var ydata = [{
  11. name: '天猫',
  12. value: 18
  13. },
  14. {
  15. name: '京东',
  16. value: 16
  17. },
  18. {
  19. name: '苏宁易购',
  20. value: 15
  21. },
  22. {
  23. name: '拼多多',
  24. value: 14
  25. },
  26. {
  27. name: '国美',
  28. value: 10
  29. },
  30. {
  31. name: '亚马逊',
  32. value: 7.9
  33. },
  34. {
  35. name: '唯品会',
  36. value: 6.7
  37. },
  38. {
  39. name: '其他',
  40. value: 6
  41. }
  42. ];
  43. var color = ["#8d7fec", "#5085f2", "#e75fc3", "#f87be2", "#f2719a", "#fca4bb", "#f59a8f", "#fdb301", "#57e7ec", "#cf9ef1"]
  44. var xdata = ['天猫', "京东", "苏宁易购", "拼多多", '国美', '亚马逊', '唯品会', '唯品会'];
  45. option = {
  46. /*backgroundColor: "rgba(255,255,255,1)",*/
  47. color: color,
  48. legend: {
  49. orient: "vartical",
  50. x: "left",
  51. top: "center",
  52. left: "53%",
  53. bottom: "0%",
  54. data: xdata,
  55. itemWidth: 8,
  56. itemHeight: 8,
  57. textStyle: {
  58. color: '#fff'
  59. },
  60. /*itemGap: 16,*/
  61. /*formatter:function(name){
  62. var oa = option.series[0].data;
  63. var num = oa[0].value + oa[1].value + oa[2].value + oa[3].value+oa[4].value + oa[5].value + oa[6].value + oa[7].value+oa[8].value + oa[9].value ;
  64. for(var i = 0; i < option.series[0].data.length; i++){
  65. if(name==oa[i].name){
  66. return ' '+name + ' | ' + oa[i].value + ' | ' + (oa[i].value/num * 100).toFixed(2) + '%';
  67. }
  68. }
  69. }*/
  70. formatter: function(name) {
  71. return '' + name
  72. }
  73. },
  74. series: [{
  75. type: 'pie',
  76. clockwise: false, //饼图的扇区是否是顺时针排布
  77. minAngle: 2, //最小的扇区角度(0 ~ 360)
  78. radius: ["20%", "60%"],
  79. center: ["30%", "45%"],
  80. avoidLabelOverlap: false,
  81. itemStyle: { //图形样式
  82. normal: {
  83. borderColor: '#ffffff',
  84. borderWidth: 1,
  85. },
  86. },
  87. label: {
  88. normal: {
  89. show: false,
  90. position: 'center',
  91. formatter: '{text|{b}}\n{c} ({d}%)',
  92. rich: {
  93. text: {
  94. color: "#fff",
  95. fontSize: 14,
  96. align: 'center',
  97. verticalAlign: 'middle',
  98. padding: 8
  99. },
  100. value: {
  101. color: "#8693F3",
  102. fontSize: 24,
  103. align: 'center',
  104. verticalAlign: 'middle',
  105. },
  106. }
  107. },
  108. emphasis: {
  109. show: true,
  110. textStyle: {
  111. fontSize: 24,
  112. }
  113. }
  114. },
  115. data: ydata
  116. }]
  117. };
  118. myChart.setOption(option);
  119. setTimeout(function() {
  120. myChart.on('mouseover', function(params) {
  121. if (params.name == ydata[0].name) {
  122. myChart.dispatchAction({
  123. type: 'highlight',
  124. seriesIndex: 0,
  125. dataIndex: 0
  126. });
  127. } else {
  128. myChart.dispatchAction({
  129. type: 'downplay',
  130. seriesIndex: 0,
  131. dataIndex: 0
  132. });
  133. }
  134. });
  135. myChart.on('mouseout', function(params) {
  136. myChart.dispatchAction({
  137. type: 'highlight',
  138. seriesIndex: 0,
  139. dataIndex: 0
  140. });
  141. });
  142. myChart.dispatchAction({
  143. type: 'highlight',
  144. seriesIndex: 0,
  145. dataIndex: 0
  146. });
  147. }, 1000);
  148. myChart.currentIndex = -1;
  149. setInterval(function () {
  150. var dataLen = option.series[0].data.length;
  151. // 取消之前高亮的图形
  152. myChart.dispatchAction({
  153. type: 'downplay',
  154. seriesIndex: 0,
  155. dataIndex: myChart.currentIndex
  156. });
  157. myChart.currentIndex = (myChart.currentIndex + 1) % dataLen;
  158. // 高亮当前图形
  159. myChart.dispatchAction({
  160. type: 'highlight',
  161. seriesIndex: 0,
  162. dataIndex: myChart.currentIndex
  163. });
  164. }, 1000);
  165. // 使用刚指定的配置项和数据显示图表。
  166. /*myChart.setOption(option);*/
  167. window.addEventListener("resize",function(){
  168. myChart.resize();
  169. });
  170. }
  171. function ceshis2() {
  172. var myChart = echarts.init(document.getElementById('chart3'));
  173. option = {
  174. /*backgroundColor: '#000',*/
  175. "animation": true,
  176. "title": {
  177. /*"text": 24,*/
  178. /* "subtext": "沥青工",*/
  179. "x": "center",
  180. "y": "center",
  181. "textStyle": {
  182. "color": "#fff",
  183. "fontSize": 10,
  184. "fontWeight": "normal",
  185. "align": "center",
  186. "width": "200px"
  187. },
  188. "subtextStyle": {
  189. "color": "#fff",
  190. "fontSize": 12,
  191. "fontWeight": "normal",
  192. "align": "center"
  193. }
  194. },
  195. "legend": {
  196. "width": "100%",
  197. "left": "center",
  198. "textStyle": {
  199. "color": "#fff",
  200. "fontSize": 12
  201. },
  202. "icon": "circle",
  203. "right": "0",
  204. "bottom": "0",
  205. "padding": [15, 20],
  206. "itemGap": 5,
  207. "data": ["化妆品", "手机", "电脑", "羽绒服", "扫地机", "电视", "洗发露", "其它"]
  208. },
  209. "series": [{
  210. "type": "pie",
  211. "center": ["50%", "40%"],
  212. "radius": ["20%", "43%"],
  213. "color": ["#FEE449", "#00FFFF", "#00FFA8", "#9F17FF", "#FFE400", "#F76F01", "#01A4F7", "#FE2C8A"],
  214. "startAngle": 135,
  215. "labelLine": {
  216. "normal": {
  217. "length": 15
  218. }
  219. },
  220. "label": {
  221. "normal": {
  222. "formatter": "{b|{b}:} {per|{d}%} ",
  223. "backgroundColor": "rgba(255, 147, 38, 0)",
  224. "borderColor": "transparent",
  225. "borderRadius": 4,
  226. "rich": {
  227. "a": {
  228. "color": "#999",
  229. "lineHeight": 12,
  230. "align": "center"
  231. },
  232. "hr": {
  233. "borderColor": "#aaa",
  234. "width": "100%",
  235. "borderWidth": 1,
  236. "height": 0
  237. },
  238. "b": {
  239. "color": "#b3e5ff",
  240. "fontSize": 16,
  241. "lineHeight": 33
  242. },
  243. "c": {
  244. "fontSize": 14,
  245. "color": "#eee"
  246. },
  247. "per": {
  248. "color": "#FDF44E",
  249. "fontSize": 14,
  250. "padding": [5, 8],
  251. "borderRadius": 2
  252. }
  253. },
  254. "textStyle": {
  255. "color": "#fff",
  256. "fontSize": 16
  257. }
  258. }
  259. },
  260. "emphasis": {
  261. "label": {
  262. "show": true,
  263. "formatter": "{b|{b}:} {per|{d}%} ",
  264. "backgroundColor": "rgba(255, 147, 38, 0)",
  265. "borderColor": "transparent",
  266. "borderRadius": 4,
  267. "rich": {
  268. "a": {
  269. "color": "#999",
  270. "lineHeight": 22,
  271. "align": "center"
  272. },
  273. "hr": {
  274. "borderColor": "#aaa",
  275. "width": "100%",
  276. "borderWidth": 1,
  277. "height": 0
  278. },
  279. "b": {
  280. "color": "#fff",
  281. "fontSize": 14,
  282. "lineHeight": 33
  283. },
  284. "c": {
  285. "fontSize": 14,
  286. "color": "#eee"
  287. },
  288. "per": {
  289. "color": "#FDF44E",
  290. "fontSize": 14,
  291. "padding": [5, 6],
  292. "borderRadius": 2
  293. }
  294. }
  295. }
  296. },
  297. "data": [{
  298. "name": "化妆品",
  299. "value": 3
  300. }, {
  301. "name": "手机",
  302. "value": 2
  303. }, {
  304. "name": "电脑",
  305. "value": 26
  306. }, {
  307. "name": "羽绒服",
  308. "value": 24
  309. }, {
  310. "name": "扫地机",
  311. "value": 12
  312. }, {
  313. "name": "电视",
  314. "value": 11
  315. }, {
  316. "name": "洗发露",
  317. "value": 3
  318. }, {
  319. "name": "其它",
  320. "value": 2
  321. }]
  322. }, {
  323. "type": "pie",
  324. "center": ["50%", "40%"],
  325. "radius": ["15%", "14%"],
  326. "label": {
  327. "show": false
  328. },
  329. "data": [{
  330. "value": 78,
  331. "name": "实例1",
  332. "itemStyle": {
  333. "normal": {
  334. "color": {
  335. "x": 0,
  336. "y": 0,
  337. "x2": 1,
  338. "y2": 0,
  339. "type": "linear",
  340. "global": false,
  341. "colorStops": [{
  342. "offset": 0,
  343. "color": "#9F17FF"
  344. }, {
  345. "offset": 0.2,
  346. "color": "#01A4F7"
  347. }, {
  348. "offset": 0.5,
  349. "color": "#FE2C8A"
  350. }, {
  351. "offset": 0.8,
  352. "color": "#FEE449"
  353. }, {
  354. "offset": 1,
  355. "color": "#00FFA8"
  356. }]
  357. }
  358. }
  359. }
  360. }]
  361. }]
  362. }
  363. // 使用刚指定的配置项和数据显示图表。
  364. myChart.setOption(option);
  365. myChart.currentIndex = -1;
  366. //myChart.setOption(option);
  367. //console.log(option.series[0].data[0]);
  368. setInterval(function () {
  369. var dataLen = option.series[0].data.length;
  370. // 取消之前高亮的图形
  371. myChart.dispatchAction({
  372. type: 'downplay',
  373. seriesIndex: 0,
  374. dataIndex: myChart.currentIndex
  375. });
  376. myChart.currentIndex = (myChart.currentIndex + 1) % dataLen;
  377. // 高亮当前图形
  378. myChart.dispatchAction({
  379. type: 'highlight',
  380. seriesIndex: 0,
  381. dataIndex: myChart.currentIndex
  382. });
  383. }, 1000);
  384. window.addEventListener("resize",function(){
  385. myChart.resize();
  386. });
  387. }
  388. function ceshis3() {
  389. var myChart = echarts.init(document.getElementById('chart4'));
  390. var colors = ['rgb(46, 199, 201)', 'rgb(90, 177, 239)', 'rgb(255, 185, 128)'];
  391. option = {
  392. color: colors,
  393. tooltip: {
  394. trigger: 'axis',
  395. axisPointer: {
  396. type: 'cross'
  397. },
  398. formatter: function(params) {
  399. // 系列
  400. let html = params[0].name + "<br>";
  401. for (var i = 0; i < params.length; i++) {
  402. // 获取每个系列对应的颜色值
  403. html += '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:' + params[i].color + ';"></span>';
  404. // 通过判断指定系列增加 % 符号
  405. if (option.series[params[i].seriesIndex].type == "line") {
  406. html += params[i].seriesName + ": " + params[i].value + "%<br>";
  407. } else {
  408. html += params[i].seriesName + ": " + params[i].value + "<br>";
  409. }
  410. }
  411. return html;
  412. }
  413. },
  414. grid: {
  415. right: '20%'
  416. },
  417. toolbox: {
  418. feature: {
  419. dataView: {
  420. show: true,
  421. readOnly: false
  422. },
  423. restore: {
  424. show: true
  425. },
  426. saveAsImage: {
  427. show: true
  428. }
  429. }
  430. },
  431. legend: {
  432. textStyle: {
  433. color: '#fff'
  434. },
  435. data: ['下单量', '付款量', '平均值']
  436. },
  437. // 缩放组件
  438. /*dataZoom: {
  439. type: 'slider'
  440. },*/
  441. xAxis: [{
  442. type: 'category',
  443. axisTick: {
  444. alignWithLabel: true
  445. },
  446. axisLabel: {
  447. formatter: '{value} 万',
  448. textStyle: {
  449. color: "#ffffff" //X轴文字颜色
  450. }
  451. },
  452. data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
  453. }],
  454. yAxis: [{
  455. type: 'value',
  456. name: '下单量',
  457. min: 0,
  458. max: 250,
  459. position: 'right',
  460. axisLine: {
  461. lineStyle: {
  462. color: colors[0]
  463. }
  464. },
  465. axisLabel: {
  466. formatter: '{value} 万'
  467. }
  468. },
  469. {
  470. type: 'value',
  471. name: '付款量',
  472. min: 0,
  473. max: 250,
  474. position: 'right',
  475. offset: 80,
  476. axisLine: {
  477. lineStyle: {
  478. color: colors[1]
  479. }
  480. },
  481. axisLabel: {
  482. formatter: '{value} 万'
  483. }
  484. },
  485. {
  486. type: 'value',
  487. name: '平均值',
  488. min: 0,
  489. max: 25,
  490. position: 'left',
  491. axisLine: {
  492. lineStyle: {
  493. color: colors[2]
  494. }
  495. },
  496. axisLabel: {
  497. formatter: '{value} 万'
  498. }
  499. }
  500. ],
  501. series: [{
  502. name: '下单量',
  503. type: 'bar',
  504. data: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],
  505. itemStyle: {
  506. normal: {
  507. barBorderRadius: 2
  508. }
  509. }
  510. },
  511. {
  512. barGap: '-50%', // 增加偏移量使重叠显示
  513. name: '付款量',
  514. type: 'bar',
  515. yAxisIndex: 1,
  516. data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3],
  517. itemStyle: {
  518. normal: {
  519. barBorderRadius: 2
  520. }
  521. }
  522. },
  523. {
  524. name: '平均值',
  525. type: 'line',
  526. yAxisIndex: 2,
  527. data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2],
  528. }
  529. ]
  530. };
  531. // 使用刚指定的配置项和数据显示图表。
  532. myChart.setOption(option);
  533. window.addEventListener("resize",function(){
  534. myChart.resize();
  535. });
  536. }
  537. function ceshis4() {
  538. var myChart = echarts.init(document.getElementById('chart5'));
  539. var labelimg = "";
  540. option = {
  541. /*backgroundColor: "#0E233E",*/
  542. "grid": {
  543. "left": "6%",
  544. "top": "10%",
  545. "right": "3%",
  546. "bottom": "15%"
  547. },
  548. "legend": {
  549. "data": [
  550. "日本",
  551. "韩国",
  552. "美国",
  553. "澳大利亚",
  554. "俄罗斯",
  555. "法国",
  556. "英国"
  557. ],
  558. "top": "92%",
  559. "icon": "circle",
  560. "textStyle": {
  561. "color": "#0DCAD2"
  562. }
  563. },
  564. "color": [
  565. "#534EE1",
  566. "#ECD64F",
  567. "#00E4F0",
  568. "#44D16D",
  569. "#124E91",
  570. "#BDC414",
  571. "#C8CCA5"
  572. ],
  573. "tooltip": {
  574. "position": "top",
  575. },
  576. "xAxis": {
  577. "type": "category",
  578. "data": [
  579. "日本",
  580. "韩国",
  581. "美国",
  582. "澳大利亚",
  583. "俄罗斯",
  584. "法国",
  585. "英国"
  586. ],
  587. "axisLabel": {
  588. "show": false,
  589. "color": "#999999",
  590. "fontSize": 16
  591. },
  592. "axisTick": {
  593. "show": false
  594. },
  595. "axisLine": {
  596. "show": false
  597. },
  598. "splitLine": {
  599. "show": false
  600. }
  601. },
  602. "yAxis": {
  603. "type": "value",
  604. "axisLabel": {
  605. "show": false,
  606. "color": "#999999",
  607. "fontSize": 16
  608. },
  609. "axisTick": {
  610. "show": false
  611. },
  612. "axisLine": {
  613. "show": false
  614. },
  615. "splitLine": {
  616. "show": false
  617. }
  618. },
  619. "series": [{
  620. "name": "日本",
  621. "data": [
  622. 0,
  623. 0,
  624. 0,
  625. 0,
  626. 0,
  627. 0,
  628. 0
  629. ],
  630. "stack": "a",
  631. "type": "bar"
  632. },
  633. {
  634. "name": "韩国",
  635. "data": [
  636. 0,
  637. 0,
  638. 0,
  639. 0,
  640. 0,
  641. 0,
  642. 0
  643. ],
  644. "stack": "a",
  645. "type": "bar"
  646. },
  647. {
  648. "name": "美国",
  649. "data": [
  650. 0,
  651. 0,
  652. 0,
  653. 0,
  654. 0,
  655. 0,
  656. 0
  657. ],
  658. "stack": "a",
  659. "type": "bar"
  660. },
  661. {
  662. "name": "澳大利亚",
  663. "data": [
  664. 0,
  665. 0,
  666. 0,
  667. 0,
  668. 0,
  669. 0,
  670. 0
  671. ],
  672. "stack": "a",
  673. "type": "bar"
  674. },
  675. {
  676. "name": "俄罗斯",
  677. "data": [
  678. 0,
  679. 0,
  680. 0,
  681. 0,
  682. 0,
  683. 0,
  684. 0
  685. ],
  686. "stack": "a",
  687. "type": "bar"
  688. },
  689. {
  690. "name": "法国",
  691. "data": [
  692. 0,
  693. 0,
  694. 0,
  695. 0,
  696. 0,
  697. 0,
  698. 0
  699. ],
  700. "stack": "a",
  701. "type": "bar"
  702. },
  703. {
  704. "name": "英国",
  705. "data": [
  706. 0,
  707. 0,
  708. 0,
  709. 0,
  710. 0,
  711. 0,
  712. 0
  713. ],
  714. "stack": "a",
  715. "type": "bar"
  716. },
  717. {
  718. "type": "pictorialBar",
  719. "name": "提示框值",
  720. "data": [{
  721. "name": "",
  722. "value": 868,
  723. "label": {
  724. "show": true,
  725. "position": "top",
  726. formatter: function(params) {
  727. var index = params.dataIndex;
  728. var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
  729. return str;
  730. },
  731. "rich": {
  732. "a": {
  733. "fontSize": 18,
  734. "color": "#534EE1",
  735. "align": "center",
  736. "height": 40
  737. },
  738. "c": {
  739. "fontSize": 18,
  740. "color": "#fff",
  741. "padding": [
  742. -2,
  743. 0,
  744. 2,
  745. 0
  746. ],
  747. "backgroundColor": {
  748. "image": labelimg
  749. },
  750. "align": "center",
  751. "verticalAlign": "bottom",
  752. "height": 50,
  753. "lineHeight": 40,
  754. "width": 100
  755. }
  756. }
  757. },
  758. "itemStyle": {
  759. "normal": {
  760. "color": {
  761. "type": "linear",
  762. "x": 0,
  763. "y": 0,
  764. "x2": 0,
  765. "y2": 1,
  766. "colorStops": [{
  767. "offset": 0,
  768. "color": "rgba(83,78,225,1)"
  769. },
  770. {
  771. "offset": 1,
  772. "color": "rgba(83,78,225,0)"
  773. }
  774. ],
  775. "global": false
  776. }
  777. }
  778. }
  779. },
  780. {
  781. "name": "",
  782. "value": 306,
  783. "label": {
  784. "show": true,
  785. "position": "top",
  786. formatter: function(params) {
  787. var index = params.dataIndex;
  788. var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
  789. return str;
  790. },
  791. "rich": {
  792. "a": {
  793. "fontSize": 18,
  794. "color": "#ECD64F",
  795. "align": "center",
  796. "height": 40
  797. },
  798. "c": {
  799. "fontSize": 18,
  800. "color": "#fff",
  801. "padding": [
  802. -4,
  803. 0,
  804. 8,
  805. 0
  806. ],
  807. "backgroundColor": {
  808. "image": labelimg
  809. },
  810. "align": "center",
  811. "verticalAlign": "bottom",
  812. "height": 45,
  813. "lineHeight": 40,
  814. "width": 100
  815. }
  816. }
  817. },
  818. "itemStyle": {
  819. "normal": {
  820. "color": {
  821. "type": "linear",
  822. "x": 0,
  823. "y": 0,
  824. "x2": 0,
  825. "y2": 1,
  826. "colorStops": [{
  827. "offset": 0,
  828. "color": "rgba(236,214,79,1)"
  829. },
  830. {
  831. "offset": 1,
  832. "color": "rgba(236,214,79,0)"
  833. }
  834. ],
  835. "global": false
  836. }
  837. }
  838. }
  839. },
  840. {
  841. "name": "",
  842. "value": 162,
  843. "label": {
  844. "show": true,
  845. "position": "top",
  846. formatter: function(params) {
  847. var index = params.dataIndex;
  848. var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
  849. return str;
  850. },
  851. "rich": {
  852. "a": {
  853. "fontSize": 18,
  854. "color": "#00E4F0",
  855. "align": "center",
  856. "height": 40
  857. },
  858. "c": {
  859. "fontSize": 18,
  860. "color": "#fff",
  861. "padding": [
  862. -4,
  863. 0,
  864. 8,
  865. 0
  866. ],
  867. "backgroundColor": {
  868. "image": labelimg
  869. },
  870. "align": "center",
  871. "verticalAlign": "bottom",
  872. "height": 45,
  873. "lineHeight": 40,
  874. "width": 100
  875. }
  876. }
  877. },
  878. "itemStyle": {
  879. "normal": {
  880. "color": {
  881. "type": "linear",
  882. "x": 0,
  883. "y": 0,
  884. "x2": 0,
  885. "y2": 1,
  886. "colorStops": [{
  887. "offset": 0,
  888. "color": "rgba(0,228,240,1)"
  889. },
  890. {
  891. "offset": 1,
  892. "color": "rgba(0,228,240,0)"
  893. }
  894. ],
  895. "global": false
  896. }
  897. }
  898. }
  899. },
  900. {
  901. "name": "",
  902. "value": 362,
  903. "label": {
  904. "show": true,
  905. formatter: function(params) {
  906. var index = params.dataIndex;
  907. var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
  908. return str;
  909. },
  910. "position": "top",
  911. "rich": {
  912. "a": {
  913. "fontSize": 18,
  914. "color": "#44D16D",
  915. "align": "center",
  916. "height": 40
  917. },
  918. "c": {
  919. "fontSize": 18,
  920. "color": "#fff",
  921. "padding": [
  922. -4,
  923. 0,
  924. 8,
  925. 0
  926. ],
  927. "backgroundColor": {
  928. "image": labelimg
  929. },
  930. "align": "center",
  931. "verticalAlign": "bottom",
  932. "height": 45,
  933. "lineHeight": 40,
  934. "width": 100
  935. }
  936. }
  937. },
  938. "itemStyle": {
  939. "normal": {
  940. "color": {
  941. "type": "linear",
  942. "x": 0,
  943. "y": 0,
  944. "x2": 0,
  945. "y2": 1,
  946. "colorStops": [{
  947. "offset": 0,
  948. "color": "rgba(68,209,109,1)"
  949. },
  950. {
  951. "offset": 1,
  952. "color": "rgba(68,209,109,0)"
  953. }
  954. ],
  955. "global": false
  956. }
  957. }
  958. }
  959. },
  960. {
  961. "name": "",
  962. "value": 460,
  963. "label": {
  964. "show": true,
  965. "position": "top",
  966. formatter: function(params) {
  967. var index = params.dataIndex;
  968. var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
  969. return str;
  970. },
  971. "rich": {
  972. "a": {
  973. "fontSize": 18,
  974. "color": "#124E91",
  975. "align": "center",
  976. "height": 30
  977. },
  978. "c": {
  979. "fontSize": 18,
  980. "color": "#fff",
  981. "padding": [
  982. -4,
  983. 0,
  984. 8,
  985. 0
  986. ],
  987. "backgroundColor": {
  988. "image": labelimg
  989. },
  990. "align": "center",
  991. "verticalAlign": "bottom",
  992. "height": 45,
  993. "lineHeight": 40,
  994. "width": 100
  995. }
  996. }
  997. },
  998. "itemStyle": {
  999. "normal": {
  1000. "color": {
  1001. "type": "linear",
  1002. "x": 0,
  1003. "y": 0,
  1004. "x2": 0,
  1005. "y2": 1,
  1006. "colorStops": [{
  1007. "offset": 0,
  1008. "color": "rgba(18,78,145,1)"
  1009. },
  1010. {
  1011. "offset": 1,
  1012. "color": "rgba(18,78,145,0)"
  1013. }
  1014. ],
  1015. "global": false
  1016. }
  1017. }
  1018. }
  1019. },
  1020. {
  1021. "name": "",
  1022. "value": 606,
  1023. "label": {
  1024. "show": true,
  1025. "position": "top",
  1026. formatter: function(params) {
  1027. var index = params.dataIndex;
  1028. var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
  1029. return str;
  1030. },
  1031. "rich": {
  1032. "a": {
  1033. "fontSize": 18,
  1034. "color": "#BDC414",
  1035. "align": "center",
  1036. "height": 30
  1037. },
  1038. "c": {
  1039. "fontSize": 18,
  1040. "color": "#fff",
  1041. "padding": [
  1042. -4,
  1043. 0,
  1044. 8,
  1045. 0
  1046. ],
  1047. "backgroundColor": {
  1048. "image": labelimg
  1049. },
  1050. "align": "center",
  1051. "verticalAlign": "bottom",
  1052. "height": 45,
  1053. "lineHeight": 40,
  1054. "width": 100
  1055. }
  1056. }
  1057. },
  1058. "itemStyle": {
  1059. "normal": {
  1060. "color": {
  1061. "type": "linear",
  1062. "x": 0,
  1063. "y": 0,
  1064. "x2": 0,
  1065. "y2": 1,
  1066. "colorStops": [{
  1067. "offset": 0,
  1068. "color": "rgba(189,196,20,1)"
  1069. },
  1070. {
  1071. "offset": 1,
  1072. "color": "rgba(189,196,20,0)"
  1073. }
  1074. ],
  1075. "global": false
  1076. }
  1077. }
  1078. }
  1079. },
  1080. {
  1081. "name": "",
  1082. "value": 506,
  1083. "label": {
  1084. "show": true,
  1085. "position": "top",
  1086. formatter: function(params) {
  1087. var index = params.dataIndex;
  1088. var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
  1089. return str;
  1090. },
  1091. "rich": {
  1092. "a": {
  1093. "fontSize": 18,
  1094. "color": "#C8CCA5",
  1095. "align": "center",
  1096. "height": 30
  1097. },
  1098. "c": {
  1099. "fontSize": 18,
  1100. "color": "#fff",
  1101. "padding": [
  1102. -4,
  1103. 0,
  1104. 8,
  1105. 0
  1106. ],
  1107. "backgroundColor": {
  1108. "image": labelimg
  1109. },
  1110. "align": "center",
  1111. "verticalAlign": "bottom",
  1112. "height": 45,
  1113. "lineHeight": 40,
  1114. "width": 100
  1115. }
  1116. }
  1117. },
  1118. "itemStyle": {
  1119. "normal": {
  1120. "color": {
  1121. "type": "linear",
  1122. "x": 0,
  1123. "y": 0,
  1124. "x2": 0,
  1125. "y2": 1,
  1126. "colorStops": [{
  1127. "offset": 0,
  1128. "color": "rgba(200,204,165,1)"
  1129. },
  1130. {
  1131. "offset": 1,
  1132. "color": "rgba(200,204,165,0)"
  1133. }
  1134. ],
  1135. "global": false
  1136. }
  1137. }
  1138. }
  1139. }
  1140. ],
  1141. "stack": "a",
  1142. "symbol": "path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z"
  1143. }
  1144. ]
  1145. }
  1146. // 使用刚指定的配置项和数据显示图表。
  1147. myChart.setOption(option);
  1148. window.addEventListener("resize",function(){
  1149. myChart.resize();
  1150. });
  1151. }
  1152. function ceshis5() {
  1153. var myChart = echarts.init(document.getElementById('map'));
  1154. var uploadedDataURL = "./js/data-1528971808162-BkOXf61WX.json";
  1155. //console.log(uploadedDataURL);
  1156. // echarts.extendsMap = function(id, opt) {
  1157. // // 实例
  1158. // var cityMap = {
  1159. // "郑州市": zhengzhou,
  1160. // "开封市": kaifeng,
  1161. // "洛阳市": luoyang,
  1162. // "平顶山市": pingdingshan,
  1163. // "安阳市": anyang,
  1164. // "鹤壁市": hebi,
  1165. // "新乡市": xinxiang,
  1166. // "焦作市": jiaozuo,
  1167. // "濮阳市": puyang,
  1168. // "漯河市": luohe,
  1169. // "三门峡市": sanmenxia,
  1170. // "南阳市": nanyang,
  1171. // "商丘市": shangqiu,
  1172. // "信阳市": xinyang,
  1173. // "周口市": zhoukou,
  1174. // "许昌市": xuchang,
  1175. // "驻马店市": zhumadian
  1176. // };
  1177. // }
  1178. var geoGpsMap = {
  1179. '1': [116.4071, 39.9046],
  1180. '2': [125.8154, 44.2584],
  1181. '3': [121.4737, 31.2303],
  1182. '4': [117.1582, 36.8701],
  1183. '5': [103.9526, 30.7617],
  1184. '6': [106.6302, 26.6470],
  1185. };
  1186. var geoCoordMap = {
  1187. "江苏": [118.8062, 31.9208],
  1188. '黑龙江': [127.9688, 45.368],
  1189. '内蒙古': [110.3467, 41.4899],
  1190. "吉林": [125.8154, 44.2584],
  1191. '北京市': [116.4551, 40.2539],
  1192. "辽宁": [123.1238, 42.1216],
  1193. "河北": [114.4995, 38.1006],
  1194. "天津": [117.4219, 39.4189],
  1195. "山西": [112.3352, 37.9413],
  1196. "陕西": [109.1162, 34.2004],
  1197. "甘肃": [103.5901, 36.3043],
  1198. "宁夏": [106.3586, 38.1775],
  1199. "青海": [101.4038, 36.8207],
  1200. "新疆": [87.9236, 43.5883],
  1201. "四川": [103.9526, 30.7617],
  1202. "重庆": [108.384366, 30.439702],
  1203. "山东": [117.1582, 36.8701],
  1204. "河南": [113.4668, 34.6234],
  1205. "安徽": [117.29, 32.0581],
  1206. "湖北": [114.3896, 30.6628],
  1207. "浙江": [119.5313, 29.8773],
  1208. "福建": [119.4543, 25.9222],
  1209. "江西": [116.0046, 28.6633],
  1210. "湖南": [113.0823, 28.2568],
  1211. "贵州": [106.6992, 26.7682],
  1212. "云南": [102.9199, 25.4663],
  1213. "广东": [113.12244, 23.009505],
  1214. "广西": [108.479, 23.1152],
  1215. "海南": [110.3893, 19.8516],
  1216. '上海': [121.4648, 31.2891],
  1217. };
  1218. var d1 = {
  1219. '江苏': 10041,
  1220. '黑龙江': 4093,
  1221. '内蒙古': 1157,
  1222. '吉林': 4903,
  1223. '北京市': 2667,
  1224. '辽宁': 8331,
  1225. '河北': 23727,
  1226. '天津': 681,
  1227. '山西': 5352,
  1228. '陕西': 38,
  1229. '甘肃': 77,
  1230. '宁夏': 65,
  1231. '青海': 10,
  1232. '新疆': 193,
  1233. '四川': 309,
  1234. '重庆': 77,
  1235. '山东': 21666,
  1236. '河南': 15717,
  1237. '安徽': 15671,
  1238. '湖北': 3714,
  1239. '浙江': 3141,
  1240. '福建': 955,
  1241. '江西': 4978,
  1242. '湖南': 778,
  1243. '贵州': 33,
  1244. '云南': 149,
  1245. '广东': 1124,
  1246. '广西': 125,
  1247. '海南': 7,
  1248. '上海': 2155,
  1249. };
  1250. var d2 = {
  1251. "江苏": 0,
  1252. '黑龙江': 0,
  1253. '内蒙古': 0,
  1254. "吉林": 0,
  1255. '北京市': 0,
  1256. "辽宁": 0,
  1257. "河北": 0,
  1258. "天津": 0,
  1259. "山西": 0,
  1260. "陕西": 0,
  1261. "甘肃": 0,
  1262. "宁夏": 0,
  1263. "青海": 0,
  1264. "新疆": 0,
  1265. "四川": 0,
  1266. "重庆": 0,
  1267. "山东": 0,
  1268. "河南": 0,
  1269. "安徽": 0,
  1270. "湖北": 0,
  1271. "浙江": 0,
  1272. "福建": 0,
  1273. "江西": 0,
  1274. "湖南": 0,
  1275. "贵州": 0,
  1276. "云南": 0,
  1277. "广东": 0,
  1278. "广西": 0,
  1279. '海南': 0,
  1280. '上海': 0,
  1281. };
  1282. var d3 = {
  1283. '江苏': 11788,
  1284. '黑龙江': 1944,
  1285. '内蒙古': 2954,
  1286. '吉林': 3482,
  1287. '北京市': 1808,
  1288. '辽宁': 5488,
  1289. '河北': 27035,
  1290. '天津': 2270,
  1291. '山西': 13623,
  1292. '陕西': 4221,
  1293. '甘肃': 754,
  1294. '宁夏': 1783,
  1295. '青海': 91,
  1296. '新疆': 1907,
  1297. '四川': 4905,
  1298. '重庆': 1420,
  1299. '山东': 39781,
  1300. '河南': 16154,
  1301. '安徽': 7914,
  1302. '湖北': 6802,
  1303. '浙江': 5812,
  1304. '福建': 3345,
  1305. '江西': 4996,
  1306. '湖南': 5627,
  1307. '贵州': 1504,
  1308. '云南': 2725,
  1309. '广东': 6339,
  1310. '广西': 1009,
  1311. '海南': 0,
  1312. '上海': 1988,
  1313. };
  1314. var d4 = {
  1315. "江苏": 0,
  1316. '黑龙江': 0,
  1317. '内蒙古': 0,
  1318. "吉林": 0,
  1319. '北京市': 0,
  1320. "辽宁": 0,
  1321. "河北": 0,
  1322. "天津": 0,
  1323. "山西": 0,
  1324. "陕西": 0,
  1325. "甘肃": 0,
  1326. "宁夏": 0,
  1327. "青海": 0,
  1328. "新疆": 0,
  1329. "四川": 0,
  1330. "重庆": 0,
  1331. "山东": 0,
  1332. "河南": 0,
  1333. "安徽": 0,
  1334. "湖北": 0,
  1335. "浙江": 0,
  1336. "福建": 0,
  1337. "江西": 0,
  1338. "湖南": 0,
  1339. "贵州": 0,
  1340. "云南": 0,
  1341. "广东": 0,
  1342. "广西": 0,
  1343. '海南': 0,
  1344. '上海': 0,
  1345. };
  1346. var d5 = {
  1347. '江苏': 159,
  1348. '黑龙江': 5,
  1349. '内蒙古': 54,
  1350. '吉林': 10,
  1351. '北京市': 0,
  1352. '辽宁': 0,
  1353. '河北': 1679,
  1354. '天津': 1,
  1355. '山西': 2698,
  1356. '陕西': 1744,
  1357. '甘肃': 362,
  1358. '宁夏': 429,
  1359. '青海': 122,
  1360. '新疆': 731,
  1361. '四川': 3925,
  1362. '重庆': 1480,
  1363. '山东': 79,
  1364. '河南': 1017,
  1365. '安徽': 208,
  1366. '湖北': 1209,
  1367. '浙江': 1418,
  1368. '福建': 1237,
  1369. '江西': 1004,
  1370. '湖南': 1511,
  1371. '贵州': 345,
  1372. '云南': 1429,
  1373. '广东': 2242,
  1374. '广西': 2271,
  1375. '海南': 59,
  1376. '上海': 8,
  1377. };
  1378. var d6 = {
  1379. "江苏": 20,
  1380. '黑龙江': 60,
  1381. '内蒙古': 80,
  1382. "吉林": 10,
  1383. '北京市': 80,
  1384. "辽宁": 40,
  1385. "河北": 50,
  1386. "天津": 60,
  1387. "山西": 40,
  1388. "陕西": 60,
  1389. "甘肃": 40,
  1390. "宁夏": 10,
  1391. "青海": 0,
  1392. "新疆": 0,
  1393. "四川": 80,
  1394. "重庆": 0,
  1395. "山东": 60,
  1396. "河南": 0,
  1397. "安徽": 0,
  1398. "湖北": 10,
  1399. "浙江": 100,
  1400. "福建": 60,
  1401. "江西": 0,
  1402. "湖南": 0,
  1403. "贵州": 150,
  1404. "云南": 0,
  1405. "广东": 80,
  1406. "广西": 0,
  1407. '海南': 0,
  1408. '上海': 50,
  1409. };
  1410. var colors = [
  1411. ["#1DE9B6", "#1DE9B6", "#FFDB5C", "#FFDB5C", "#04B9FF", "#04B9FF"],
  1412. ["#1DE9B6", "#F46E36", "#04B9FF", "#5DBD32", "#FFC809", "#FB95D5", "#BDA29A", "#6E7074", "#546570", "#C4CCD3"],
  1413. ["#37A2DA", "#67E0E3", "#32C5E9", "#9FE6B8", "#FFDB5C", "#FF9F7F", "#FB7293", "#E062AE", "#E690D1", "#E7BCF3", "#9D96F5", "#8378EA", "#8378EA"],
  1414. ["#DD6B66", "#759AA0", "#E69D87", "#8DC1A9", "#EA7E53", "#EEDD78", "#73A373", "#73B9BC", "#7289AB", "#91CA8C", "#F49F42"],
  1415. ];
  1416. var colorIndex = 0;
  1417. $(function() {
  1418. // var geoCoordMap = {
  1419. // '郑州': [113.64964385, 34.7566100641],
  1420. // '开封': [114.351642118, 34.8018541758],
  1421. // '洛阳': [112.447524769, 34.6573678177],
  1422. // '平顶山': [113.300848978, 33.7453014565],
  1423. // '安阳': [114.351806508, 36.1102667222],
  1424. // '鹤壁': [114.297769838, 35.7554258742],
  1425. // '新乡': [113.912690161, 35.3072575577],
  1426. // '焦作': [113.211835885, 35.234607555],
  1427. // '濮阳': [115.026627441, 35.7532978882],
  1428. // '漯河': [114.0460614, 33.5762786885],
  1429. // '三门峡': [111.181262093, 34.7833199411],
  1430. // '南阳': [112.542841901, 33.0114195691],
  1431. // "商丘": [115.641885688, 34.4385886402],
  1432. // '信阳': [114.085490993, 32.1285823075],
  1433. // '周口': [114.654101942, 33.6237408181],
  1434. // '许昌': [113.83531246, 34.0267395887],
  1435. // '驻马店': [114.049153547, 32.9831581541]
  1436. // };
  1437. var year = ["北京", "长春", "上海", "青岛", "成都", "贵阳"];
  1438. var mapData = [
  1439. [],
  1440. [],
  1441. [],
  1442. [],
  1443. [],
  1444. [],
  1445. ];
  1446. /*柱子Y名称*/
  1447. var categoryData = [];
  1448. var barData = [];
  1449. for (var key in geoCoordMap) {
  1450. mapData[0].push({
  1451. "year": '长春',
  1452. "name": key,
  1453. "value": d1[key] / 100,
  1454. "value1": d1[key] / 100,
  1455. });
  1456. mapData[1].push({
  1457. "year": '长春',
  1458. "name": key,
  1459. "value": d1[key] / 100,
  1460. "value1": d2[key] / 100,
  1461. });
  1462. mapData[2].push({
  1463. "year": '青岛',
  1464. "name": key,
  1465. "value": d3[key] / 100,
  1466. "value1": d3[key] / 100,
  1467. });
  1468. mapData[3].push({
  1469. "year": '青岛',
  1470. "name": key,
  1471. "value": d3[key] / 100,
  1472. "value1": d4[key] / 100,
  1473. });
  1474. mapData[4].push({
  1475. "year": '成都',
  1476. "name": key,
  1477. "value": d5[key] / 100,
  1478. "value1": d5[key] / 100,
  1479. });
  1480. mapData[5].push({
  1481. "year": '成都',
  1482. "name": key,
  1483. "value": d5[key] / 100,
  1484. "value1": d6[key] / 100,
  1485. });
  1486. }
  1487. for (var i = 0; i < mapData.length; i++) {
  1488. mapData[i].sort(function sortNumber(a, b) {
  1489. return a.value - b.value
  1490. });
  1491. barData.push([]);
  1492. categoryData.push([]);
  1493. for (var j = 0; j < mapData[i].length; j++) {
  1494. barData[i].push(mapData[i][j].value1);
  1495. categoryData[i].push(mapData[i][j].name);
  1496. }
  1497. }
  1498. /*$.getJSON(uploadedDataURL, function(geoJson) {*/
  1499. /*echarts.registerMap('china', geoJson);*/
  1500. /*echarts.registerMap('china', geoJson);*/
  1501. var convertData = function(data) {
  1502. var res = [];
  1503. for (var i = 0; i < data.length; i++) {
  1504. var geoCoord = geoCoordMap[data[i].name];
  1505. if (geoCoord) {
  1506. res.push({
  1507. name: data[i].name,
  1508. value: geoCoord.concat(data[i].value)
  1509. });
  1510. }
  1511. }
  1512. return res;
  1513. };
  1514. var convertToLineData = function(data, gps) {
  1515. var res = [];
  1516. for (var i = 0; i < data.length; i++) {
  1517. var dataItem = data[i];
  1518. var toCoord = geoCoordMap[dataItem.name];
  1519. //debugger;
  1520. var fromCoord = gps; //郑州
  1521. // var toCoord = geoGps[Math.random()*3];
  1522. if (fromCoord && toCoord) {
  1523. res.push([{
  1524. coord: fromCoord,
  1525. value: dataItem.value
  1526. }, {
  1527. coord: toCoord,
  1528. }]);
  1529. }
  1530. }
  1531. return res;
  1532. };
  1533. optionXyMap01 = {
  1534. timeline: {
  1535. data: year,
  1536. axisType: 'category',
  1537. autoPlay: true,
  1538. playInterval: 3000,
  1539. left: '10%',
  1540. right: '10%',
  1541. bottom: '3%',
  1542. width: '80%',
  1543. // height: null,
  1544. label: {
  1545. normal: {
  1546. textStyle: {
  1547. color: '#ddd'
  1548. }
  1549. },
  1550. emphasis: {
  1551. textStyle: {
  1552. color: '#fff'
  1553. }
  1554. }
  1555. },
  1556. symbolSize: 10,
  1557. lineStyle: {
  1558. color: '#555'
  1559. },
  1560. checkpointStyle: {
  1561. borderColor: '#777',
  1562. borderWidth: 2
  1563. },
  1564. controlStyle: {
  1565. showNextBtn: true,
  1566. showPrevBtn: true,
  1567. normal: {
  1568. color: '#666',
  1569. borderColor: '#666'
  1570. },
  1571. emphasis: {
  1572. color: '#aaa',
  1573. borderColor: '#aaa'
  1574. }
  1575. },
  1576. },
  1577. baseOption: {
  1578. animation: true,
  1579. animationDuration: 1000,
  1580. animationEasing: 'cubicInOut',
  1581. animationDurationUpdate: 1000,
  1582. animationEasingUpdate: 'cubicInOut',
  1583. grid: {
  1584. right: '1%',
  1585. top: '15%',
  1586. bottom: '10%',
  1587. width: '20%'
  1588. },
  1589. tooltip: {
  1590. trigger: 'axis', // hover触发器
  1591. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  1592. type: 'shadow', // 默认为直线,可选为:'line' | 'shadow'
  1593. shadowStyle: {
  1594. color: 'rgba(150,150,150,0.1)' //hover颜色
  1595. }
  1596. }
  1597. },
  1598. geo: {
  1599. show: true,
  1600. map: 'china',
  1601. roam: true,
  1602. zoom: 1,
  1603. center: [113.83531246, 34.0267395887],
  1604. label: {
  1605. emphasis: {
  1606. show: false
  1607. }
  1608. },
  1609. itemStyle: {
  1610. normal: {
  1611. borderColor: 'rgba(147, 235, 248, 1)',
  1612. borderWidth: 1,
  1613. areaColor: {
  1614. type: 'radial',
  1615. x: 0.5,
  1616. y: 0.5,
  1617. r: 0.8,
  1618. colorStops: [{
  1619. offset: 0,
  1620. color: 'rgba(147, 235, 248, 0)' // 0% 处的颜色
  1621. }, {
  1622. offset: 1,
  1623. color: 'rgba(147, 235, 248, .2)' // 100% 处的颜色
  1624. }],
  1625. globalCoord: false // 缺省为 false
  1626. },
  1627. shadowColor: 'rgba(128, 217, 248, 1)',
  1628. // shadowColor: 'rgba(255, 255, 255, 1)',
  1629. shadowOffsetX: -2,
  1630. shadowOffsetY: 2,
  1631. shadowBlur: 10
  1632. },
  1633. emphasis: {
  1634. areaColor: '#389BB7',
  1635. borderWidth: 0
  1636. }
  1637. }
  1638. },
  1639. },
  1640. options: []
  1641. };
  1642. for (var n = 0; n < year.length; n++) {
  1643. optionXyMap01.options.push({
  1644. /*backgroundColor: '#013954',*/
  1645. title:
  1646. [{
  1647. text: '物流平台',
  1648. subtext: ' ',
  1649. left: '35%',
  1650. top: '15%',
  1651. textStyle: {
  1652. color: '#fff',
  1653. fontSize: 25
  1654. }
  1655. },
  1656. {
  1657. id: 'statistic',
  1658. text: year[n] + "数据统计情况",
  1659. left: '75%',
  1660. top: '8%',
  1661. textStyle: {
  1662. color: '#fff',
  1663. fontSize: 25
  1664. }
  1665. }
  1666. ],
  1667. xAxis: {
  1668. type: 'value',
  1669. scale: true,
  1670. position: 'top',
  1671. min: 0,
  1672. boundaryGap: false,
  1673. splitLine: {
  1674. show: false
  1675. },
  1676. axisLine: {
  1677. show: false
  1678. },
  1679. axisTick: {
  1680. show: false
  1681. },
  1682. axisLabel: {
  1683. margin: 2,
  1684. textStyle: {
  1685. color: '#aaa'
  1686. }
  1687. },
  1688. },
  1689. yAxis: {
  1690. type: 'category',
  1691. // name: 'TOP 20',
  1692. nameGap: 16,
  1693. axisLine: {
  1694. show: true,
  1695. lineStyle: {
  1696. color: '#ddd'
  1697. }
  1698. },
  1699. axisTick: {
  1700. show: false,
  1701. lineStyle: {
  1702. color: '#ddd'
  1703. }
  1704. },
  1705. axisLabel: {
  1706. interval: 0,
  1707. textStyle: {
  1708. color: '#ddd'
  1709. }
  1710. },
  1711. data: categoryData[n]
  1712. },
  1713. series: [
  1714. //未知作用
  1715. {
  1716. //文字和标志
  1717. name: 'light',
  1718. type: 'scatter',
  1719. coordinateSystem: 'geo',
  1720. data: convertData(mapData[n]),
  1721. symbolSize: function(val) {
  1722. return val[2] / 10;
  1723. },
  1724. label: {
  1725. normal: {
  1726. formatter: '{b}',
  1727. position: 'right',
  1728. show: true
  1729. },
  1730. emphasis: {
  1731. show: true
  1732. }
  1733. },
  1734. itemStyle: {
  1735. normal: {
  1736. color: colors[colorIndex][n]
  1737. }
  1738. }
  1739. },
  1740. //地图?
  1741. {
  1742. type: 'map',
  1743. map: 'china',
  1744. geoIndex: 0,
  1745. aspectScale: 0.75, //长宽比
  1746. showLegendSymbol: false, // 存在legend时显示
  1747. label: {
  1748. normal: {
  1749. show: false
  1750. },
  1751. emphasis: {
  1752. show: false,
  1753. textStyle: {
  1754. color: '#fff'
  1755. }
  1756. }
  1757. },
  1758. roam: true,
  1759. itemStyle: {
  1760. normal: {
  1761. areaColor: '#031525',
  1762. borderColor: '#FFFFFF',
  1763. },
  1764. emphasis: {
  1765. areaColor: '#2B91B7'
  1766. }
  1767. },
  1768. animation: false,
  1769. data: mapData
  1770. },
  1771. //地图点的动画效果
  1772. {
  1773. // name: 'Top 5',
  1774. type: 'effectScatter',
  1775. coordinateSystem: 'geo',
  1776. data: convertData(mapData[n].sort(function(a, b) {
  1777. return b.value - a.value;
  1778. }).slice(0, 20)),
  1779. symbolSize: function(val) {
  1780. return val[2] / 10;
  1781. },
  1782. showEffectOn: 'render',
  1783. rippleEffect: {
  1784. brushType: 'stroke'
  1785. },
  1786. hoverAnimation: true,
  1787. label: {
  1788. normal: {
  1789. formatter: '{b}',
  1790. position: 'right',
  1791. show: true
  1792. }
  1793. },
  1794. itemStyle: {
  1795. normal: {
  1796. color: colors[colorIndex][n],
  1797. shadowBlur: 10,
  1798. shadowColor: colors[colorIndex][n]
  1799. }
  1800. },
  1801. zlevel: 1
  1802. },
  1803. //地图线的动画效果
  1804. {
  1805. type: 'lines',
  1806. zlevel: 2,
  1807. effect: {
  1808. show: true,
  1809. period: 4, //箭头指向速度,值越小速度越快
  1810. trailLength: 0.1, //特效尾迹长度[0,1]值越大,尾迹越长重
  1811. symbol: 'arrow', //箭头图标
  1812. symbolSize: 5, //图标大小
  1813. },
  1814. lineStyle: {
  1815. normal: {
  1816. color: colors[colorIndex][n],
  1817. width: 0.3, //尾迹线条宽度
  1818. opacity: 0.8, //尾迹线条透明度
  1819. curveness: .3 //尾迹线条曲直度
  1820. }
  1821. },
  1822. data: convertToLineData(mapData[n], geoGpsMap[n + 1])
  1823. },
  1824. //柱状图
  1825. {
  1826. zlevel: 1.5,
  1827. type: 'bar',
  1828. symbol: 'none',
  1829. itemStyle: {
  1830. normal: {
  1831. color: colors[colorIndex][n]
  1832. }
  1833. },
  1834. data: barData[n]
  1835. }
  1836. ]
  1837. })
  1838. }
  1839. myChart.setOption(optionXyMap01);
  1840. /*});*/
  1841. });
  1842. function randomNum(minNum, maxNum) {
  1843. switch (arguments.length) {
  1844. case 1:
  1845. return parseInt(Math.random() * minNum + 1, 10);
  1846. break;
  1847. case 2:
  1848. return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
  1849. break;
  1850. default:
  1851. return 0;
  1852. break;
  1853. }
  1854. }
  1855. // 使用刚指定的配置项和数据显示图表。
  1856. //myChart.setOption(option);
  1857. window.addEventListener("resize",function(){
  1858. myChart.resize();
  1859. });
  1860. }
  1861. function ceshis7() {
  1862. var myChart = echarts.init(document.getElementById('chart_1'));
  1863. // 使用刚指定的配置项和数据显示图表。
  1864. myChart.setOption(option);
  1865. window.addEventListener("resize",function(){
  1866. myChart.resize();
  1867. });
  1868. }
  1869. });