environment.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  7. <link rel="stylesheet" href="style/reset.css" />
  8. <link rel="stylesheet" href="style/public.css" />
  9. <link rel="stylesheet" href="style/environment.css" />
  10. <link rel="stylesheet" href="font/iconfont.css" />
  11. <title>Document</title>
  12. </head>
  13. <body>
  14. <header class="title">
  15. <i class="iconfont iconshuye"></i>
  16. 人居环境
  17. </header>
  18. <div class="line"></div>
  19. <section class="s1">
  20. <div class="card" id="gongshang"></div>
  21. <div class="card" id="no-nongdu"></div>
  22. <div class="line"></div>
  23. <div class="card" id="pm-nongdu"></div>
  24. <div class="card" id="so-nongdu"></div>
  25. </section>
  26. <div class="line"></div>
  27. <section class="s2">
  28. <div class="card" id="gdp"></div>
  29. <div class="card" id="outIn"></div>
  30. <div class="line"></div>
  31. <div class="card" id="addVal"></div>
  32. <div class="card" id="xiaofei"></div>
  33. </section>
  34. <script src="js/echarts.min.js"></script>
  35. <script>
  36. (function() {
  37. let gongshangOption = {
  38. title: {
  39. text: "空气质量指数",
  40. textStyle: {
  41. color: "#fff"
  42. }
  43. },
  44. series: [
  45. {
  46. type: "gauge",
  47. radius: "100%",
  48. center: ["50%", "68%"],
  49. splitNumber: 0, //刻度数量
  50. startAngle: 220,
  51. endAngle: -40,
  52. axisLine: {
  53. show: true,
  54. lineStyle: {
  55. width: 20,
  56. color: [[0.5, "#fe9b36"], [1, "#ccc"]]
  57. }
  58. },
  59. //分隔线样式。
  60. splitLine: {
  61. show: false
  62. },
  63. axisLabel: {
  64. show: false
  65. },
  66. axisTick: {
  67. show: false
  68. },
  69. pointer: {
  70. show: false
  71. },
  72. title: {
  73. show: true,
  74. offsetCenter: [0, "20%"], // x, y,单位px
  75. textStyle: {
  76. color: "#01d4ea",
  77. fontSize: 10
  78. }
  79. },
  80. //仪表盘详情,用于显示数据。
  81. detail: {
  82. show: true,
  83. offsetCenter: [0, "-20%"],
  84. color: "#fff",
  85. formatter: function(params) {
  86. return params;
  87. },
  88. textStyle: {
  89. fontSize: 18,
  90. fontWeight: "bold"
  91. }
  92. },
  93. data: [
  94. {
  95. name: "温馨提示:可以正常在\n户外运动,易敏感人群\n减少外出",
  96. value: ['63 良'],
  97. textStyle: {
  98. fontSize: 18
  99. }
  100. }
  101. ]
  102. }
  103. ]
  104. };
  105. let noOption = {
  106. title: {
  107. text: "NO2季日平均浓度",
  108. textStyle: {
  109. color: "#fff"
  110. }
  111. },
  112. series: [
  113. {
  114. type: "gauge",
  115. radius: "100%",
  116. center: ["50%", "68%"],
  117. splitNumber: 0, //刻度数量
  118. startAngle: 220,
  119. endAngle: -40,
  120. axisLine: {
  121. show: true,
  122. lineStyle: {
  123. width: 20,
  124. color: [[0.68, "#ffe354"], [1, "#ccc"]]
  125. }
  126. },
  127. //分隔线样式。
  128. splitLine: {
  129. show: false
  130. },
  131. axisLabel: {
  132. show: false
  133. },
  134. axisTick: {
  135. show: false
  136. },
  137. pointer: {
  138. show: true,
  139. width: "8%",
  140. length: '70%',
  141. },
  142. itemStyle:{
  143. color:'#fff'
  144. },
  145. title: {
  146. show: false,
  147. offsetCenter: [0, "20%"], // x, y,单位px
  148. textStyle: {
  149. color: "#01d4ea",
  150. fontSize: 10
  151. }
  152. },
  153. //仪表盘详情,用于显示数据。
  154. detail: {
  155. show: true,
  156. offsetCenter: [0, "40%"],
  157. color: "#fff",
  158. formatter: function(params) {
  159. return params;
  160. },
  161. textStyle: {
  162. fontSize: 18,
  163. fontWeight: "bold"
  164. }
  165. },
  166. data: [
  167. {
  168. show:false,
  169. name: "温馨提示:可以正常在\n户外运动,易敏感人群\n减少外出",
  170. value: 63,
  171. textStyle: {
  172. fontSize: 18
  173. }
  174. }
  175. ]
  176. }
  177. ]
  178. };
  179. let pmOption = {
  180. title: {
  181. text: "PM2.5季日平均浓度",
  182. textStyle: {
  183. color: "#fff"
  184. }
  185. },
  186. series: [
  187. {
  188. type: "gauge",
  189. radius: "100%",
  190. center: ["50%", "68%"],
  191. splitNumber: 0, //刻度数量
  192. startAngle: 220,
  193. endAngle: -40,
  194. axisLine: {
  195. show: true,
  196. lineStyle: {
  197. width: 20,
  198. color: [[0.68, "#06cafd"], [1, "#ccc"]]
  199. }
  200. },
  201. //分隔线样式。
  202. splitLine: {
  203. show: false
  204. },
  205. axisLabel: {
  206. show: false
  207. },
  208. axisTick: {
  209. show: false
  210. },
  211. pointer: {
  212. show: true,
  213. width: "8%",
  214. length: '70%',
  215. },
  216. itemStyle:{
  217. color:'#fff'
  218. },
  219. title: {
  220. show: false,
  221. offsetCenter: [0, "20%"], // x, y,单位px
  222. textStyle: {
  223. color: "#01d4ea",
  224. fontSize: 10
  225. }
  226. },
  227. //仪表盘详情,用于显示数据。
  228. detail: {
  229. show:true,
  230. offsetCenter: [0, "40%"],
  231. color: "#fff",
  232. formatter: function(params) {
  233. return params;
  234. },
  235. textStyle: {
  236. fontSize: 18,
  237. fontWeight: "bold"
  238. }
  239. },
  240. data: [
  241. {
  242. show:false,
  243. name: "温馨提示:可以正常在\n户外运动,易敏感人群\n减少外出",
  244. value: 46,
  245. textStyle: {
  246. fontSize: 18
  247. }
  248. }
  249. ]
  250. }
  251. ]
  252. };
  253. let soOption = {
  254. title: {
  255. text: "SO2季日平均浓度",
  256. textStyle: {
  257. color: "#fff"
  258. }
  259. },
  260. series: [
  261. {
  262. type: "gauge",
  263. radius: "100%",
  264. center: ["50%", "68%"],
  265. splitNumber: 0, //刻度数量
  266. startAngle: 220,
  267. endAngle: -40,
  268. axisLine: {
  269. show: true,
  270. lineStyle: {
  271. width: 20,
  272. color: [[0.68, "#ffe354"], [1, "#ccc"]]
  273. }
  274. },
  275. //分隔线样式。
  276. splitLine: {
  277. show: false
  278. },
  279. axisLabel: {
  280. show: false
  281. },
  282. axisTick: {
  283. show: false
  284. },
  285. pointer: {
  286. show: true,
  287. width: "8%",
  288. length: '70%',
  289. },
  290. itemStyle:{
  291. color:'#fff'
  292. },
  293. title: {
  294. show: false,
  295. offsetCenter: [0, "20%"], // x, y,单位px
  296. textStyle: {
  297. color: "#01d4ea",
  298. fontSize: 10
  299. }
  300. },
  301. //仪表盘详情,用于显示数据。
  302. detail: {
  303. show:true,
  304. offsetCenter: [0, "40%"],
  305. color: "#fff",
  306. formatter: function(params) {
  307. return params;
  308. },
  309. textStyle: {
  310. fontSize: 18,
  311. fontWeight: "bold"
  312. }
  313. },
  314. data: [
  315. {
  316. show:false,
  317. name: "温馨提示:可以正常在\n户外运动,易敏感人群\n减少外出",
  318. value: 28,
  319. textStyle: {
  320. fontSize: 18
  321. }
  322. }
  323. ]
  324. }
  325. ]};
  326. let gdpOption = {
  327. title: {
  328. text: "森林面积及覆盖率",
  329. textStyle: {
  330. color: "#fff"
  331. }
  332. },
  333. color: ["#ff9a32", "#ffe354"],
  334. tooltip: {
  335. trigger: "axis",
  336. axisPointer: {
  337. // 坐标轴指示器,坐标轴触发有效
  338. type: "shadow" // 默认为直线,可选为:'line' | 'shadow'
  339. }
  340. },
  341. grid: {
  342. left: "3%",
  343. right: "4%",
  344. bottom: "13%",
  345. top: "27%",
  346. containLabel: true,
  347. borderColor: "#fff"
  348. },
  349. legend: {
  350. itemWidth: 14,
  351. itemHeight: 5,
  352. itemGap: 1,
  353. data: ["森林面积(千公顷)", "森林覆盖率"],
  354. x: "0",
  355. y: "90%",
  356. textStyle: {
  357. color: "#fff",
  358. fontSize: 10
  359. }
  360. },
  361. xAxis: {
  362. data: ["2013", "2014", "2015", "2016", "2017"],
  363. axisLine: {
  364. lineStyle: {
  365. color: "#ffffff"
  366. }
  367. },
  368. axisTick: {
  369. show: false //隐藏X轴刻度
  370. },
  371. axisLabel: {
  372. show: true,
  373. textStyle: {
  374. color: "#fff" //X轴文字颜色
  375. }
  376. }
  377. },
  378. yAxis: [
  379. {
  380. type: "value",
  381. splitLine: {
  382. show: false
  383. },
  384. splitLine: {
  385. show: false
  386. },
  387. axisTick: {
  388. show: false
  389. },
  390. axisLine: {
  391. lineStyle: {
  392. color: "#ffffff"
  393. }
  394. },
  395. axisLabel: {
  396. show: true,
  397. textStyle: {
  398. color: "#fff"
  399. }
  400. }
  401. },
  402. {
  403. type: "value",
  404. position: "right",
  405. splitLine: {
  406. show: false
  407. },
  408. axisTick: {
  409. show: false
  410. },
  411. axisLine: {
  412. lineStyle: {
  413. color: "#ffffff"
  414. }
  415. },
  416. axisLabel: {
  417. show: true,
  418. formatter: "{value} %", //右侧Y轴文字显示
  419. textStyle: {
  420. color: "#fff"
  421. }
  422. }
  423. }
  424. ],
  425. series: [
  426. {
  427. name: "森林覆盖率",
  428. type: "line",
  429. yAxisIndex: 1, //使用的 y 轴的 index,在单个图表实例中存在多个 y轴的时候有用
  430. smooth: true, //平滑曲线显示
  431. showAllSymbol: true, //显示所有图形。
  432. symbol: "circle", //标记的图形为实心圆
  433. symbolSize: 10, //标记的大小
  434. data: [43.6, 45.2, 45.7, 45.7, 46.3]
  435. },
  436. {
  437. name: "森林面积(千公顷)",
  438. type: "bar",
  439. data: [407.3, 421.51, 430.18, 430.49, 437.9]
  440. }
  441. ]
  442. };
  443. let outInOption = {
  444. title: {
  445. text: "公园面积及个数",
  446. textStyle: {
  447. color: "#fff"
  448. }
  449. },
  450. color: ["#ffe354", "#ff9a32"],
  451. legend: {
  452. icon: "rect",
  453. itemWidth: 14,
  454. itemHeight: 5,
  455. itemGap: 1,
  456. data: ["公园面积(公顷)", "公园个数"],
  457. x: "0",
  458. y:'90%',
  459. textStyle: {
  460. fontSize: 12,
  461. color: "#fff"
  462. }
  463. },
  464. tooltip: {
  465. trigger: "axis",
  466. axisPointer: {
  467. // 坐标轴指示器,坐标轴触发有效
  468. type: "shadow" // 默认为直线,可选为:'line' | 'shadow'
  469. }
  470. },
  471. grid: {
  472. left: "3%",
  473. right: "4%",
  474. bottom: "13%",
  475. top: "22%",
  476. containLabel: true,
  477. borderColor: "#fff"
  478. },
  479. xAxis: [
  480. {
  481. type: "category",
  482. data: ["2013","2014","2015", "2016", "2017"],
  483. axisTick: {
  484. alignWithLabel: true
  485. },
  486. axisLine: {
  487. lineStyle: {
  488. color: "#ffffff"
  489. }
  490. }
  491. }
  492. ],
  493. yAxis: [
  494. {
  495. type: "value",
  496. splitLine: {
  497. show: false
  498. },
  499. axisLine: {
  500. lineStyle: {
  501. color: "#ffffff"
  502. }
  503. }
  504. },
  505. {
  506. type: "value",
  507. position: "right",
  508. max:500,
  509. splitLine: {
  510. show: false
  511. },
  512. axisTick: {
  513. show: false
  514. },
  515. axisLine: {
  516. lineStyle: {
  517. color: "#ffffff"
  518. }
  519. },
  520. axisLabel: {
  521. show: true,
  522. formatter: "{value}", //右侧Y轴文字显示
  523. textStyle: {
  524. color: "#fff"
  525. }
  526. }
  527. }
  528. ],
  529. series: [
  530. {
  531. name: "公园面积(公顷)",
  532. type: "bar",
  533. barWidth: "40%",
  534. data: [2364, 3260.32, 2999.49, 3546.44,3666.35],
  535. },{
  536. name: "公园个数",
  537. type: "bar",
  538. barWidth: "40%",
  539. yAxisIndex: 1, //使用的 y 轴的 index,在单个图表实例中存在多个 y轴的时候有用
  540. data: [117,134,141,161,378],
  541. barGap:"-100%"
  542. }
  543. ]
  544. };
  545. let addValOption = {
  546. title: {
  547. text: "饮用水达标率",
  548. textStyle: {
  549. color: "#fff"
  550. }
  551. },
  552. color: ["#ffe354"],
  553. tooltip: {
  554. trigger: "axis",
  555. axisPointer: {
  556. // 坐标轴指示器,坐标轴触发有效
  557. type: "shadow" // 默认为直线,可选为:'line' | 'shadow'
  558. }
  559. },
  560. grid: {
  561. left: "3%",
  562. right: "4%",
  563. bottom: "3%",
  564. top: "33%",
  565. containLabel: true,
  566. borderColor: "#fff"
  567. },
  568. xAxis: [
  569. {
  570. type: "category",
  571. data: ["2013","2014","2015", "2016", "2017"],
  572. axisTick: {
  573. alignWithLabel: true
  574. },
  575. axisLine: {
  576. lineStyle: {
  577. color: "#ffffff"
  578. }
  579. }
  580. }
  581. ],
  582. yAxis: [
  583. {
  584. name:"(%)",
  585. type: "value",
  586. splitLine: {
  587. show: false
  588. },
  589. axisLine: {
  590. lineStyle: {
  591. color: "#ffffff"
  592. }
  593. }
  594. }
  595. ],
  596. series: [
  597. {
  598. name: "达标率(%)",
  599. type: "bar",
  600. barWidth: "40%",
  601. data: [100, 100, 100, 100, 100]
  602. }
  603. ]
  604. };
  605. let xiaofeiOption = {
  606. title: {
  607. text: "空气质量良好天数",
  608. textStyle: {
  609. color: "#fff"
  610. }
  611. },
  612. color: ["#ffe354"],
  613. tooltip: {
  614. trigger: "axis",
  615. axisPointer: {
  616. // 坐标轴指示器,坐标轴触发有效
  617. type: "shadow" // 默认为直线,可选为:'line' | 'shadow'
  618. }
  619. },
  620. grid: {
  621. left: "3%",
  622. right: "4%",
  623. bottom: "3%",
  624. top: "33%",
  625. containLabel: true,
  626. borderColor: "#fff"
  627. },
  628. xAxis: [
  629. {
  630. type: "category",
  631. data: ["2013", "2014", "2015","2016","2017"],
  632. axisTick: {
  633. alignWithLabel: true
  634. },
  635. axisLine: {
  636. lineStyle: {
  637. color: "#ffffff"
  638. }
  639. }
  640. }
  641. ],
  642. yAxis: [
  643. {
  644. name:"(天)",
  645. type: "value",
  646. splitLine: {
  647. show: false
  648. },
  649. axisLine: {
  650. lineStyle: {
  651. color: "#ffffff"
  652. }
  653. }
  654. }
  655. ],
  656. series: [
  657. {
  658. name: "天数(天)",
  659. type: "bar",
  660. barWidth: "40%",
  661. data: [341, 293, 322, 309, 282]
  662. }
  663. ]
  664. };
  665. let gdpChart = echarts.init(document.querySelector("#gdp"));
  666. let outInChart = echarts.init(document.querySelector("#outIn"));
  667. let addValChart = echarts.init(document.querySelector("#addVal"));
  668. let xiaofeiChart = echarts.init(document.querySelector("#xiaofei"));
  669. let gongshangChart = echarts.init(document.querySelector("#gongshang"));
  670. let noChart = echarts.init(document.querySelector("#no-nongdu"));
  671. let pmChart = echarts.init(document.querySelector("#pm-nongdu"));
  672. let soChart = echarts.init(document.querySelector("#so-nongdu"));
  673. gdpChart.setOption(gdpOption);
  674. outInChart.setOption(outInOption);
  675. addValChart.setOption(addValOption);
  676. xiaofeiChart.setOption(xiaofeiOption);
  677. gongshangChart.setOption(gongshangOption);
  678. noChart.setOption(noOption);
  679. pmChart.setOption(pmOption);
  680. soChart.setOption(soOption);
  681. })();
  682. let arr = (Array.from(document.querySelectorAll('.s1 .card'))).concat(Array.from(document.querySelectorAll('.s2 .card')))
  683. arr.forEach((dom, index) => {
  684. dom.addEventListener('click', e => {
  685. console.log('environmentClickHandle',index);
  686. window.environmentClickHandle && window.environmentClickHandle(index)
  687. })
  688. })
  689. </script>
  690. </body>
  691. </html>