echarts.js 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380
  1. $(function () {
  2. ceshis();
  3. ceshis1();
  4. ceshis2();
  5. ceshis3();
  6. ceshis4();
  7. function ceshis() {
  8. var myChart = echarts.init(document.getElementById('chart1'));
  9. option = {
  10. /*backgroundColor: '#05163B',*/
  11. tooltip: {
  12. trigger: 'axis'
  13. },
  14. toolbox: {
  15. show: true,
  16. feature: {
  17. mark: {
  18. show: true
  19. },
  20. dataView: {
  21. show: true,
  22. readOnly: false
  23. },
  24. magicType: {
  25. show: true,
  26. type: ['line', 'bar']
  27. },
  28. restore: {
  29. show: true
  30. },
  31. saveAsImage: {
  32. show: true
  33. }
  34. }
  35. },
  36. grid: {
  37. top: 'middle',
  38. left: '3%',
  39. right: '4%',
  40. bottom: '3%',
  41. top: '10%',
  42. containLabel: true
  43. },
  44. legend: {
  45. data: ['压力', '温度', '累计', '累计2'],
  46. textStyle: {
  47. color: "#fff"
  48. }
  49. },
  50. xAxis: [{
  51. type: 'category',
  52. data: ['挖土方(m³)', '挖石方(m³)', '填方(m³)', '涵洞通道(道)', '桩基(根)', '承台(个)', '墩柱(含肋板)(根)', '台帽盖梁(个)', '梁板预制(片)', '梁板安装(片)', '桥面铺装(㎡)', '防撞护栏(m)',
  53. '明洞(米)', '主动掘进(米)', '初期支护(米)', '二次衬砌(米)', '水稳底基层(米)', '水稳基层(第一层)(米)', '水稳基层(第二层)(米)', '上基层(米)', '沥青下面层(米)', '沥青上面层(米)',
  54. ],
  55. axisLabel: {
  56. show: true,
  57. textStyle: {
  58. color: "#ebf8ac" //X轴文字颜色
  59. }
  60. },
  61. axisLine: {
  62. lineStyle: {
  63. color: '#01FCE3'
  64. }
  65. },
  66. }],
  67. yAxis: [{
  68. type: 'value',
  69. name: '压力',
  70. axisLabel: {
  71. formatter: '{value} KPa',
  72. textStyle: {
  73. color: "#2EC7C9" //X轴文字颜色
  74. }
  75. },
  76. axisLine: {
  77. lineStyle: {
  78. color: '#01FCE3'
  79. }
  80. },
  81. },
  82. {
  83. type: 'value',
  84. name: '温度',
  85. axisLabel: {
  86. formatter: '{value} °C',
  87. textStyle: {
  88. color: "#2EC7C9" //X轴文字颜色
  89. }
  90. },axisLine: {
  91. lineStyle: {
  92. color: '#01FCE3'
  93. }
  94. },
  95. }
  96. ],
  97. series: [
  98. {
  99. name: '压力',
  100. type: 'bar',
  101. itemStyle: {
  102. normal: {
  103. barBorderRadius: 5,
  104. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  105. offset: 0,
  106. color: "#00FFE3"
  107. },
  108. {
  109. offset: 1,
  110. color: "#4693EC"
  111. }
  112. ])
  113. }
  114. },
  115. /*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]*/
  116. data: [26.4, 28.7, 70.7, 75.6, 82.2, 48.7, 58.8, 16.0, 32.3, 30.3, 21.3, 66.3, 41.3, 15.3, 30.3, 22.3, 12.3, 82.3, 72.3, 62.3, 52.3, 42.3, 36.6],
  117. },
  118. {
  119. name: '温度',
  120. type: 'bar',
  121. itemStyle: {
  122. normal: {
  123. barBorderRadius: 5,
  124. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  125. offset: 0,
  126. color: "#C1B2EA"
  127. },
  128. {
  129. offset: 1,
  130. color: "#8362C6"
  131. }
  132. ])
  133. }
  134. },
  135. data: [26.4, 28.7, 70.7, 75.6, 82.2, 48.7, 58.8, 16.0, 32.3, 30.3, 21.3, 66.3, 41.3, 15.3, 30.3, 22.3, 12.3, 82.3, 72.3, 62.3, 52.3, 42.3, 36.6],
  136. },
  137. {
  138. name: '累计',
  139. type: 'line',
  140. yAxisIndex: 1,
  141. data: [26.4, 28.7, 70.7, 75.6, 82.2, 48.7, 58.8, 16.0, 32.3, 30.3, 21.3, 66.3, 41.3, 15.3, 30.3, 22.3, 12.3, 82.3, 72.3, 62.3, 52.3, 42.3, 36.6],
  142. lineStyle: {
  143. normal: {
  144. width: 5,
  145. color: {
  146. type: 'linear',
  147. colorStops: [{
  148. offset: 0,
  149. color: '#AAF487' // 0% 处的颜色
  150. },
  151. {
  152. offset: 0.4,
  153. color: '#47D8BE' // 100% 处的颜色
  154. }, {
  155. offset: 1,
  156. color: '#47D8BE' // 100% 处的颜色
  157. }
  158. ],
  159. globalCoord: false // 缺省为 false
  160. },
  161. shadowColor: 'rgba(71,216,190, 0.5)',
  162. shadowBlur: 10,
  163. shadowOffsetY: 7
  164. }
  165. },
  166. itemStyle: {
  167. normal: {
  168. color: '#AAF487',
  169. borderWidth: 10,
  170. /*shadowColor: 'rgba(72,216,191, 0.3)',
  171. shadowBlur: 100,*/
  172. borderColor: "#AAF487"
  173. }
  174. },
  175. smooth: true,
  176. },
  177. {
  178. name: '累计2',
  179. type: 'line',
  180. yAxisIndex: 1,
  181. data: [26.4, 28.7, 70.7, 75.6, 82.2, 48.7, 58.8, 16.0, 32.3, 30.3, 21.3, 66.3, 41.3, 15.3, 30.3, 22.3, 12.3, 82.3, 72.3, 62.3, 52.3, 42.3, 36.6],
  182. lineStyle: {
  183. normal: {
  184. width: 5,
  185. color: {
  186. type: 'linear',
  187. colorStops: [{
  188. offset: 0,
  189. color: '#F8B854' // 0% 处的颜色
  190. },
  191. {
  192. offset: 0.4,
  193. color: '#DE801C' // 100% 处的颜色
  194. }, {
  195. offset: 1,
  196. color: '#DE801C' // 100% 处的颜色
  197. }
  198. ],
  199. globalCoord: false // 缺省为 false
  200. },
  201. shadowColor: 'rgba(71,216,190, 0.5)',
  202. shadowBlur: 10,
  203. shadowOffsetY: 7
  204. }
  205. },
  206. itemStyle: {
  207. normal: {
  208. color: '#F7AD3E',
  209. borderWidth: 10,
  210. /*shadowColor: 'rgba(72,216,191, 0.3)',
  211. shadowBlur: 100,*/
  212. borderColor: "#F7AD3E"
  213. }
  214. },
  215. smooth: true,
  216. }
  217. ]
  218. };
  219. // 使用刚指定的配置项和数据显示图表。
  220. myChart.setOption(option);
  221. window.addEventListener("resize",function(){
  222. myChart.resize();
  223. });
  224. }
  225. function ceshis1() {
  226. var myChart = echarts.init(document.getElementById('chart2'));
  227. var ydata = [{
  228. name: '财务管理决策实训',
  229. value: 18
  230. },
  231. {
  232. name: '商品流通业实训',
  233. value: 16
  234. },
  235. {
  236. name: '暖心陪伴(津乐园20cm定制蛋糕)',
  237. value: 15
  238. },
  239. {
  240. name: '嘉果荟萃(津乐园20cm定制蛋糕)',
  241. value: 14
  242. },
  243. {
  244. name: '优雅圆舞曲(津乐园20cm)',
  245. value: 10
  246. },
  247. {
  248. name: '巧克力之夏(津乐园20cm定制蛋糕)',
  249. value: 7.9
  250. },
  251. {
  252. name: '财税宝4G',
  253. value: 6.7
  254. },
  255. {
  256. name: '成本会计',
  257. value: 6
  258. },
  259. {
  260. name: '纳税会计与筹划',
  261. value: 4.5
  262. },
  263. {
  264. name: '金融担保业实训',
  265. value: 3
  266. }
  267. ];
  268. var color = ["#8d7fec", "#5085f2", "#e75fc3", "#f87be2", "#f2719a", "#fca4bb", "#f59a8f", "#fdb301", "#57e7ec", "#cf9ef1"]
  269. var xdata = ['财务管理决策实训', "商品流通业实训", "暖心陪伴(津乐园20cm定制蛋糕)", "嘉果荟萃(津乐园20cm定制蛋糕)", '优雅圆舞曲(津乐园20cm)', '巧克力之夏(津乐园20cm定制蛋糕)', '财税宝4G', '成本会计', '纳税会计与筹划', '金融担保业实训'];
  270. option = {
  271. /*backgroundColor: "rgba(255,255,255,1)",*/
  272. color: color,
  273. legend: {
  274. orient: "vartical",
  275. x: "left",
  276. top: "center",
  277. left: "53%",
  278. bottom: "0%",
  279. data: xdata,
  280. itemWidth: 8,
  281. itemHeight: 8,
  282. textStyle: {
  283. color: '#fff'
  284. },
  285. /*itemGap: 16,*/
  286. /*formatter:function(name){
  287. var oa = option.series[0].data;
  288. 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 ;
  289. for(var i = 0; i < option.series[0].data.length; i++){
  290. if(name==oa[i].name){
  291. return ' '+name + ' | ' + oa[i].value + ' | ' + (oa[i].value/num * 100).toFixed(2) + '%';
  292. }
  293. }
  294. }*/
  295. formatter: function(name) {
  296. return '' + name
  297. }
  298. },
  299. series: [{
  300. type: 'pie',
  301. clockwise: false, //饼图的扇区是否是顺时针排布
  302. minAngle: 2, //最小的扇区角度(0 ~ 360)
  303. radius: ["20%", "60%"],
  304. center: ["30%", "45%"],
  305. avoidLabelOverlap: false,
  306. itemStyle: { //图形样式
  307. normal: {
  308. borderColor: '#ffffff',
  309. borderWidth: 1,
  310. },
  311. },
  312. label: {
  313. normal: {
  314. show: false,
  315. position: 'center',
  316. formatter: '{text|{b}}\n{c} ({d}%)',
  317. rich: {
  318. text: {
  319. color: "#fff",
  320. fontSize: 14,
  321. align: 'center',
  322. verticalAlign: 'middle',
  323. padding: 8
  324. },
  325. value: {
  326. color: "#8693F3",
  327. fontSize: 24,
  328. align: 'center',
  329. verticalAlign: 'middle',
  330. },
  331. }
  332. },
  333. emphasis: {
  334. show: true,
  335. textStyle: {
  336. fontSize: 24,
  337. }
  338. }
  339. },
  340. data: ydata
  341. }]
  342. };
  343. myChart.setOption(option);
  344. setTimeout(function() {
  345. myChart.on('mouseover', function(params) {
  346. if (params.name == ydata[0].name) {
  347. myChart.dispatchAction({
  348. type: 'highlight',
  349. seriesIndex: 0,
  350. dataIndex: 0
  351. });
  352. } else {
  353. myChart.dispatchAction({
  354. type: 'downplay',
  355. seriesIndex: 0,
  356. dataIndex: 0
  357. });
  358. }
  359. });
  360. myChart.on('mouseout', function(params) {
  361. myChart.dispatchAction({
  362. type: 'highlight',
  363. seriesIndex: 0,
  364. dataIndex: 0
  365. });
  366. });
  367. myChart.dispatchAction({
  368. type: 'highlight',
  369. seriesIndex: 0,
  370. dataIndex: 0
  371. });
  372. }, 1000);
  373. // 使用刚指定的配置项和数据显示图表。
  374. /*myChart.setOption(option);*/
  375. window.addEventListener("resize",function(){
  376. myChart.resize();
  377. });
  378. }
  379. function ceshis2() {
  380. var myChart = echarts.init(document.getElementById('chart3'));
  381. option = {
  382. /*backgroundColor: '#000',*/
  383. "animation": true,
  384. "title": {
  385. /*"text": 24,*/
  386. /* "subtext": "沥青工",*/
  387. "x": "center",
  388. "y": "center",
  389. "textStyle": {
  390. "color": "#fff",
  391. "fontSize": 10,
  392. "fontWeight": "normal",
  393. "align": "center",
  394. "width": "200px"
  395. },
  396. "subtextStyle": {
  397. "color": "#fff",
  398. "fontSize": 12,
  399. "fontWeight": "normal",
  400. "align": "center"
  401. }
  402. },
  403. "legend": {
  404. "width": "100%",
  405. "left": "center",
  406. "textStyle": {
  407. "color": "#fff",
  408. "fontSize": 12
  409. },
  410. "icon": "circle",
  411. "right": "0",
  412. "bottom": "0",
  413. "padding": [70, 20],
  414. "itemGap": 5,
  415. "data": ["测量工", "电焊工", "钢筋工", "沥青工", "安装工", "起重工", "养护工", "其它"]
  416. },
  417. "series": [{
  418. "type": "pie",
  419. "center": ["50%", "40%"],
  420. "radius": ["20%", "43%"],
  421. "color": ["#FEE449", "#00FFFF", "#00FFA8", "#9F17FF", "#FFE400", "#F76F01", "#01A4F7", "#FE2C8A"],
  422. "startAngle": 135,
  423. "labelLine": {
  424. "normal": {
  425. "length": 15
  426. }
  427. },
  428. "label": {
  429. "normal": {
  430. "formatter": "{b|{b}:} {per|{d}%} ",
  431. "backgroundColor": "rgba(255, 147, 38, 0)",
  432. "borderColor": "transparent",
  433. "borderRadius": 4,
  434. "rich": {
  435. "a": {
  436. "color": "#999",
  437. "lineHeight": 12,
  438. "align": "center"
  439. },
  440. "hr": {
  441. "borderColor": "#aaa",
  442. "width": "100%",
  443. "borderWidth": 1,
  444. "height": 0
  445. },
  446. "b": {
  447. "color": "#b3e5ff",
  448. "fontSize": 16,
  449. "lineHeight": 33
  450. },
  451. "c": {
  452. "fontSize": 14,
  453. "color": "#eee"
  454. },
  455. "per": {
  456. "color": "#FDF44E",
  457. "fontSize": 14,
  458. "padding": [5, 8],
  459. "borderRadius": 2
  460. }
  461. },
  462. "textStyle": {
  463. "color": "#fff",
  464. "fontSize": 16
  465. }
  466. }
  467. },
  468. "emphasis": {
  469. "label": {
  470. "show": true,
  471. "formatter": "{b|{b}:} {per|{d}%} ",
  472. "backgroundColor": "rgba(255, 147, 38, 0)",
  473. "borderColor": "transparent",
  474. "borderRadius": 4,
  475. "rich": {
  476. "a": {
  477. "color": "#999",
  478. "lineHeight": 22,
  479. "align": "center"
  480. },
  481. "hr": {
  482. "borderColor": "#aaa",
  483. "width": "100%",
  484. "borderWidth": 1,
  485. "height": 0
  486. },
  487. "b": {
  488. "color": "#fff",
  489. "fontSize": 14,
  490. "lineHeight": 33
  491. },
  492. "c": {
  493. "fontSize": 14,
  494. "color": "#eee"
  495. },
  496. "per": {
  497. "color": "#FDF44E",
  498. "fontSize": 14,
  499. "padding": [5, 6],
  500. "borderRadius": 2
  501. }
  502. }
  503. }
  504. },
  505. "data": [{
  506. "name": "测量工",
  507. "value": 3
  508. }, {
  509. "name": "电焊工",
  510. "value": 2
  511. }, {
  512. "name": "钢筋工",
  513. "value": 26
  514. }, {
  515. "name": "沥青工",
  516. "value": 24
  517. }, {
  518. "name": "安装工",
  519. "value": 12
  520. }, {
  521. "name": "起重工",
  522. "value": 11
  523. }, {
  524. "name": "养护工",
  525. "value": 3
  526. }, {
  527. "name": "其它",
  528. "value": 2
  529. }]
  530. }, {
  531. "type": "pie",
  532. "center": ["50%", "40%"],
  533. "radius": ["15%", "14%"],
  534. "label": {
  535. "show": false
  536. },
  537. "data": [{
  538. "value": 78,
  539. "name": "实例1",
  540. "itemStyle": {
  541. "normal": {
  542. "color": {
  543. "x": 0,
  544. "y": 0,
  545. "x2": 1,
  546. "y2": 0,
  547. "type": "linear",
  548. "global": false,
  549. "colorStops": [{
  550. "offset": 0,
  551. "color": "#9F17FF"
  552. }, {
  553. "offset": 0.2,
  554. "color": "#01A4F7"
  555. }, {
  556. "offset": 0.5,
  557. "color": "#FE2C8A"
  558. }, {
  559. "offset": 0.8,
  560. "color": "#FEE449"
  561. }, {
  562. "offset": 1,
  563. "color": "#00FFA8"
  564. }]
  565. }
  566. }
  567. }
  568. }]
  569. }]
  570. }
  571. // 使用刚指定的配置项和数据显示图表。
  572. myChart.setOption(option);
  573. window.addEventListener("resize",function(){
  574. myChart.resize();
  575. });
  576. }
  577. function ceshis3() {
  578. var myChart = echarts.init(document.getElementById('chart4'));
  579. var colors = ['rgb(46, 199, 201)', 'rgb(90, 177, 239)', 'rgb(255, 185, 128)'];
  580. option = {
  581. color: colors,
  582. tooltip: {
  583. trigger: 'axis',
  584. axisPointer: {
  585. type: 'cross'
  586. },
  587. formatter: function(params) {
  588. // 系列
  589. let html = params[0].name + "<br>";
  590. for (var i = 0; i < params.length; i++) {
  591. // 获取每个系列对应的颜色值
  592. html += '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:' + params[i].color + ';"></span>';
  593. // 通过判断指定系列增加 % 符号
  594. if (option.series[params[i].seriesIndex].type == "line") {
  595. html += params[i].seriesName + ": " + params[i].value + "%<br>";
  596. } else {
  597. html += params[i].seriesName + ": " + params[i].value + "<br>";
  598. }
  599. }
  600. return html;
  601. }
  602. },
  603. grid: {
  604. right: '20%'
  605. },
  606. toolbox: {
  607. feature: {
  608. dataView: {
  609. show: true,
  610. readOnly: false
  611. },
  612. restore: {
  613. show: true
  614. },
  615. saveAsImage: {
  616. show: true
  617. }
  618. }
  619. },
  620. legend: {
  621. textStyle: {
  622. color: '#fff'
  623. },
  624. data: ['蒸发量', '降水量', '平均温度']
  625. },
  626. // 缩放组件
  627. /*dataZoom: {
  628. type: 'slider'
  629. },*/
  630. xAxis: [{
  631. type: 'category',
  632. axisTick: {
  633. alignWithLabel: true
  634. },
  635. axisLabel: {
  636. formatter: '{value} ',
  637. textStyle: {
  638. color: "#ffffff" //X轴文字颜色
  639. }
  640. },
  641. data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
  642. }],
  643. yAxis: [{
  644. type: 'value',
  645. name: '蒸发量',
  646. min: 0,
  647. max: 250,
  648. position: 'right',
  649. axisLine: {
  650. lineStyle: {
  651. color: colors[0]
  652. }
  653. },
  654. axisLabel: {
  655. formatter: '{value} ml'
  656. }
  657. },
  658. {
  659. type: 'value',
  660. name: '降水量',
  661. min: 0,
  662. max: 250,
  663. position: 'right',
  664. offset: 80,
  665. axisLine: {
  666. lineStyle: {
  667. color: colors[1]
  668. }
  669. },
  670. axisLabel: {
  671. formatter: '{value} ml'
  672. }
  673. },
  674. {
  675. type: 'value',
  676. name: '温度',
  677. min: 0,
  678. max: 25,
  679. position: 'left',
  680. axisLine: {
  681. lineStyle: {
  682. color: colors[2]
  683. }
  684. },
  685. axisLabel: {
  686. formatter: '{value} °C'
  687. }
  688. }
  689. ],
  690. series: [{
  691. name: '蒸发量',
  692. type: 'bar',
  693. 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],
  694. itemStyle: {
  695. normal: {
  696. barBorderRadius: 2
  697. }
  698. }
  699. },
  700. {
  701. barGap: '-50%', // 增加偏移量使重叠显示
  702. name: '降水量',
  703. type: 'bar',
  704. yAxisIndex: 1,
  705. 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],
  706. itemStyle: {
  707. normal: {
  708. barBorderRadius: 2
  709. }
  710. }
  711. },
  712. {
  713. name: '平均温度',
  714. type: 'line',
  715. yAxisIndex: 2,
  716. 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],
  717. }
  718. ]
  719. };
  720. // 使用刚指定的配置项和数据显示图表。
  721. myChart.setOption(option);
  722. window.addEventListener("resize",function(){
  723. myChart.resize();
  724. });
  725. }
  726. function ceshis4() {
  727. var myChart = echarts.init(document.getElementById('chart5'));
  728. var labelimg = "/asset/get/s/data-1575019476644-Rak5eXt1.png";
  729. option = {
  730. /*backgroundColor: "#0E233E",*/
  731. "grid": {
  732. "left": "6%",
  733. "top": "10%",
  734. "right": "3%",
  735. "bottom": "15%"
  736. },
  737. "legend": {
  738. "data": [
  739. "信息",
  740. "往下场所",
  741. "关系",
  742. "关联",
  743. "人",
  744. "物",
  745. "组织"
  746. ],
  747. "top": "92%",
  748. "icon": "circle",
  749. "textStyle": {
  750. "color": "#0DCAD2"
  751. }
  752. },
  753. "color": [
  754. "#534EE1",
  755. "#ECD64F",
  756. "#00E4F0",
  757. "#44D16D",
  758. "#124E91",
  759. "#BDC414",
  760. "#C8CCA5"
  761. ],
  762. "tooltip": {
  763. "position": "top",
  764. },
  765. "xAxis": {
  766. "type": "category",
  767. "data": [
  768. "信息",
  769. "往下场所",
  770. "关系",
  771. "关联",
  772. "人",
  773. "物",
  774. "组织"
  775. ],
  776. "axisLabel": {
  777. "show": false,
  778. "color": "#999999",
  779. "fontSize": 16
  780. },
  781. "axisTick": {
  782. "show": false
  783. },
  784. "axisLine": {
  785. "show": false
  786. },
  787. "splitLine": {
  788. "show": false
  789. }
  790. },
  791. "yAxis": {
  792. "type": "value",
  793. "axisLabel": {
  794. "show": false,
  795. "color": "#999999",
  796. "fontSize": 16
  797. },
  798. "axisTick": {
  799. "show": false
  800. },
  801. "axisLine": {
  802. "show": false
  803. },
  804. "splitLine": {
  805. "show": false
  806. }
  807. },
  808. "series": [{
  809. "name": "信息",
  810. "data": [
  811. 0,
  812. 0,
  813. 0,
  814. 0,
  815. 0,
  816. 0,
  817. 0
  818. ],
  819. "stack": "a",
  820. "type": "bar"
  821. },
  822. {
  823. "name": "往下场所",
  824. "data": [
  825. 0,
  826. 0,
  827. 0,
  828. 0,
  829. 0,
  830. 0,
  831. 0
  832. ],
  833. "stack": "a",
  834. "type": "bar"
  835. },
  836. {
  837. "name": "关系",
  838. "data": [
  839. 0,
  840. 0,
  841. 0,
  842. 0,
  843. 0,
  844. 0,
  845. 0
  846. ],
  847. "stack": "a",
  848. "type": "bar"
  849. },
  850. {
  851. "name": "关联",
  852. "data": [
  853. 0,
  854. 0,
  855. 0,
  856. 0,
  857. 0,
  858. 0,
  859. 0
  860. ],
  861. "stack": "a",
  862. "type": "bar"
  863. },
  864. {
  865. "name": "人",
  866. "data": [
  867. 0,
  868. 0,
  869. 0,
  870. 0,
  871. 0,
  872. 0,
  873. 0
  874. ],
  875. "stack": "a",
  876. "type": "bar"
  877. },
  878. {
  879. "name": "物",
  880. "data": [
  881. 0,
  882. 0,
  883. 0,
  884. 0,
  885. 0,
  886. 0,
  887. 0
  888. ],
  889. "stack": "a",
  890. "type": "bar"
  891. },
  892. {
  893. "name": "组织",
  894. "data": [
  895. 0,
  896. 0,
  897. 0,
  898. 0,
  899. 0,
  900. 0,
  901. 0
  902. ],
  903. "stack": "a",
  904. "type": "bar"
  905. },
  906. {
  907. "type": "pictorialBar",
  908. "name": "提示框值",
  909. "data": [{
  910. "name": "",
  911. "value": 868,
  912. "label": {
  913. "show": true,
  914. "position": "top",
  915. formatter: function(params) {
  916. var index = params.dataIndex;
  917. var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
  918. return str;
  919. },
  920. "rich": {
  921. "a": {
  922. "fontSize": 18,
  923. "color": "#534EE1",
  924. "align": "center",
  925. "height": 40
  926. },
  927. "c": {
  928. "fontSize": 18,
  929. "color": "#fff",
  930. "padding": [
  931. -2,
  932. 0,
  933. 2,
  934. 0
  935. ],
  936. "backgroundColor": {
  937. "image": labelimg
  938. },
  939. "align": "center",
  940. "verticalAlign": "bottom",
  941. "height": 50,
  942. "lineHeight": 40,
  943. "width": 100
  944. }
  945. }
  946. },
  947. "itemStyle": {
  948. "normal": {
  949. "color": {
  950. "type": "linear",
  951. "x": 0,
  952. "y": 0,
  953. "x2": 0,
  954. "y2": 1,
  955. "colorStops": [{
  956. "offset": 0,
  957. "color": "rgba(83,78,225,1)"
  958. },
  959. {
  960. "offset": 1,
  961. "color": "rgba(83,78,225,0)"
  962. }
  963. ],
  964. "global": false
  965. }
  966. }
  967. }
  968. },
  969. {
  970. "name": "",
  971. "value": 306,
  972. "label": {
  973. "show": true,
  974. "position": "top",
  975. formatter: function(params) {
  976. var index = params.dataIndex;
  977. var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
  978. return str;
  979. },
  980. "rich": {
  981. "a": {
  982. "fontSize": 18,
  983. "color": "#ECD64F",
  984. "align": "center",
  985. "height": 40
  986. },
  987. "c": {
  988. "fontSize": 18,
  989. "color": "#fff",
  990. "padding": [
  991. -4,
  992. 0,
  993. 8,
  994. 0
  995. ],
  996. "backgroundColor": {
  997. "image": labelimg
  998. },
  999. "align": "center",
  1000. "verticalAlign": "bottom",
  1001. "height": 45,
  1002. "lineHeight": 40,
  1003. "width": 100
  1004. }
  1005. }
  1006. },
  1007. "itemStyle": {
  1008. "normal": {
  1009. "color": {
  1010. "type": "linear",
  1011. "x": 0,
  1012. "y": 0,
  1013. "x2": 0,
  1014. "y2": 1,
  1015. "colorStops": [{
  1016. "offset": 0,
  1017. "color": "rgba(236,214,79,1)"
  1018. },
  1019. {
  1020. "offset": 1,
  1021. "color": "rgba(236,214,79,0)"
  1022. }
  1023. ],
  1024. "global": false
  1025. }
  1026. }
  1027. }
  1028. },
  1029. {
  1030. "name": "",
  1031. "value": 162,
  1032. "label": {
  1033. "show": true,
  1034. "position": "top",
  1035. formatter: function(params) {
  1036. var index = params.dataIndex;
  1037. var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
  1038. return str;
  1039. },
  1040. "rich": {
  1041. "a": {
  1042. "fontSize": 18,
  1043. "color": "#00E4F0",
  1044. "align": "center",
  1045. "height": 40
  1046. },
  1047. "c": {
  1048. "fontSize": 18,
  1049. "color": "#fff",
  1050. "padding": [
  1051. -4,
  1052. 0,
  1053. 8,
  1054. 0
  1055. ],
  1056. "backgroundColor": {
  1057. "image": labelimg
  1058. },
  1059. "align": "center",
  1060. "verticalAlign": "bottom",
  1061. "height": 45,
  1062. "lineHeight": 40,
  1063. "width": 100
  1064. }
  1065. }
  1066. },
  1067. "itemStyle": {
  1068. "normal": {
  1069. "color": {
  1070. "type": "linear",
  1071. "x": 0,
  1072. "y": 0,
  1073. "x2": 0,
  1074. "y2": 1,
  1075. "colorStops": [{
  1076. "offset": 0,
  1077. "color": "rgba(0,228,240,1)"
  1078. },
  1079. {
  1080. "offset": 1,
  1081. "color": "rgba(0,228,240,0)"
  1082. }
  1083. ],
  1084. "global": false
  1085. }
  1086. }
  1087. }
  1088. },
  1089. {
  1090. "name": "",
  1091. "value": 362,
  1092. "label": {
  1093. "show": true,
  1094. formatter: function(params) {
  1095. var index = params.dataIndex;
  1096. var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
  1097. return str;
  1098. },
  1099. "position": "top",
  1100. "rich": {
  1101. "a": {
  1102. "fontSize": 18,
  1103. "color": "#44D16D",
  1104. "align": "center",
  1105. "height": 40
  1106. },
  1107. "c": {
  1108. "fontSize": 18,
  1109. "color": "#fff",
  1110. "padding": [
  1111. -4,
  1112. 0,
  1113. 8,
  1114. 0
  1115. ],
  1116. "backgroundColor": {
  1117. "image": labelimg
  1118. },
  1119. "align": "center",
  1120. "verticalAlign": "bottom",
  1121. "height": 45,
  1122. "lineHeight": 40,
  1123. "width": 100
  1124. }
  1125. }
  1126. },
  1127. "itemStyle": {
  1128. "normal": {
  1129. "color": {
  1130. "type": "linear",
  1131. "x": 0,
  1132. "y": 0,
  1133. "x2": 0,
  1134. "y2": 1,
  1135. "colorStops": [{
  1136. "offset": 0,
  1137. "color": "rgba(68,209,109,1)"
  1138. },
  1139. {
  1140. "offset": 1,
  1141. "color": "rgba(68,209,109,0)"
  1142. }
  1143. ],
  1144. "global": false
  1145. }
  1146. }
  1147. }
  1148. },
  1149. {
  1150. "name": "",
  1151. "value": 460,
  1152. "label": {
  1153. "show": true,
  1154. "position": "top",
  1155. formatter: function(params) {
  1156. var index = params.dataIndex;
  1157. var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
  1158. return str;
  1159. },
  1160. "rich": {
  1161. "a": {
  1162. "fontSize": 18,
  1163. "color": "#124E91",
  1164. "align": "center",
  1165. "height": 30
  1166. },
  1167. "c": {
  1168. "fontSize": 18,
  1169. "color": "#fff",
  1170. "padding": [
  1171. -4,
  1172. 0,
  1173. 8,
  1174. 0
  1175. ],
  1176. "backgroundColor": {
  1177. "image": labelimg
  1178. },
  1179. "align": "center",
  1180. "verticalAlign": "bottom",
  1181. "height": 45,
  1182. "lineHeight": 40,
  1183. "width": 100
  1184. }
  1185. }
  1186. },
  1187. "itemStyle": {
  1188. "normal": {
  1189. "color": {
  1190. "type": "linear",
  1191. "x": 0,
  1192. "y": 0,
  1193. "x2": 0,
  1194. "y2": 1,
  1195. "colorStops": [{
  1196. "offset": 0,
  1197. "color": "rgba(18,78,145,1)"
  1198. },
  1199. {
  1200. "offset": 1,
  1201. "color": "rgba(18,78,145,0)"
  1202. }
  1203. ],
  1204. "global": false
  1205. }
  1206. }
  1207. }
  1208. },
  1209. {
  1210. "name": "",
  1211. "value": 606,
  1212. "label": {
  1213. "show": true,
  1214. "position": "top",
  1215. formatter: function(params) {
  1216. var index = params.dataIndex;
  1217. var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
  1218. return str;
  1219. },
  1220. "rich": {
  1221. "a": {
  1222. "fontSize": 18,
  1223. "color": "#BDC414",
  1224. "align": "center",
  1225. "height": 30
  1226. },
  1227. "c": {
  1228. "fontSize": 18,
  1229. "color": "#fff",
  1230. "padding": [
  1231. -4,
  1232. 0,
  1233. 8,
  1234. 0
  1235. ],
  1236. "backgroundColor": {
  1237. "image": labelimg
  1238. },
  1239. "align": "center",
  1240. "verticalAlign": "bottom",
  1241. "height": 45,
  1242. "lineHeight": 40,
  1243. "width": 100
  1244. }
  1245. }
  1246. },
  1247. "itemStyle": {
  1248. "normal": {
  1249. "color": {
  1250. "type": "linear",
  1251. "x": 0,
  1252. "y": 0,
  1253. "x2": 0,
  1254. "y2": 1,
  1255. "colorStops": [{
  1256. "offset": 0,
  1257. "color": "rgba(189,196,20,1)"
  1258. },
  1259. {
  1260. "offset": 1,
  1261. "color": "rgba(189,196,20,0)"
  1262. }
  1263. ],
  1264. "global": false
  1265. }
  1266. }
  1267. }
  1268. },
  1269. {
  1270. "name": "",
  1271. "value": 506,
  1272. "label": {
  1273. "show": true,
  1274. "position": "top",
  1275. formatter: function(params) {
  1276. var index = params.dataIndex;
  1277. var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
  1278. return str;
  1279. },
  1280. "rich": {
  1281. "a": {
  1282. "fontSize": 18,
  1283. "color": "#C8CCA5",
  1284. "align": "center",
  1285. "height": 30
  1286. },
  1287. "c": {
  1288. "fontSize": 18,
  1289. "color": "#fff",
  1290. "padding": [
  1291. -4,
  1292. 0,
  1293. 8,
  1294. 0
  1295. ],
  1296. "backgroundColor": {
  1297. "image": labelimg
  1298. },
  1299. "align": "center",
  1300. "verticalAlign": "bottom",
  1301. "height": 45,
  1302. "lineHeight": 40,
  1303. "width": 100
  1304. }
  1305. }
  1306. },
  1307. "itemStyle": {
  1308. "normal": {
  1309. "color": {
  1310. "type": "linear",
  1311. "x": 0,
  1312. "y": 0,
  1313. "x2": 0,
  1314. "y2": 1,
  1315. "colorStops": [{
  1316. "offset": 0,
  1317. "color": "rgba(200,204,165,1)"
  1318. },
  1319. {
  1320. "offset": 1,
  1321. "color": "rgba(200,204,165,0)"
  1322. }
  1323. ],
  1324. "global": false
  1325. }
  1326. }
  1327. }
  1328. }
  1329. ],
  1330. "stack": "a",
  1331. "symbol": "path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z"
  1332. }
  1333. ]
  1334. }
  1335. // 使用刚指定的配置项和数据显示图表。
  1336. myChart.setOption(option);
  1337. window.addEventListener("resize",function(){
  1338. myChart.resize();
  1339. });
  1340. }
  1341. function ceshis5() {
  1342. var myChart = echarts.init(document.getElementById('chart_1'));
  1343. // 使用刚指定的配置项和数据显示图表。
  1344. myChart.setOption(option);
  1345. window.addEventListener("resize",function(){
  1346. myChart.resize();
  1347. });
  1348. }
  1349. });