index.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017
  1. $(function(){
  2. map();
  3. leidatu();
  4. wuran();
  5. huaxing();
  6. zhexian();
  7. function leida1(){
  8. var myChart = echarts.init(document.getElementById('map'));
  9. myChart.setOption(option);
  10. window.addEventListener("resize",function(){
  11. myChart.resize();
  12. });
  13. }
  14. })
  15. function map(){
  16. var myChart = echarts.init(document.getElementById('map'));
  17. let iconRQ = "image://data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAUCAYAAABiS3YzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTM4IDc5LjE1OTgyNCwgMjAxNi8wOS8xNC0wMTowOTowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjNCRkRBMEJBQzgwRjExRUFBNUI0RTMyMThEN0UxMzFEIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjNCRkRBMEJCQzgwRjExRUFBNUI0RTMyMThEN0UxMzFEIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6M0JGREEwQjhDODBGMTFFQUE1QjRFMzIxOEQ3RTEzMUQiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6M0JGREEwQjlDODBGMTFFQUE1QjRFMzIxOEQ3RTEzMUQiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5mT42iAAABQ0lEQVR42mL8LabOQCQIBOL1xChkItJAkLp+IBajpqFWQCwPxJ7UNDQCSgdQy1BmIA6Bsl2AmJMahjoAsTiUzQPETtQwNAKN709IAwvUayZQ/hcg/o0k/x6Ig9D0+ABxKJT9HYh/oMm/BBm6GYitgTgfiBmJcLkkEK/CIXcGiGNB3v8JxIVQF31gIA/8AeIWaNK7gRymG4BYH4hPkGjgXSC2A+JaWNChR9QjqIJeIP5PhIGzgdgAiI8Tin2QbSVAvIOAgROBOA0auUQlKV4gtidgqBGp6RSUFrmIKA/ESDEUPcGfBOIUIH6Lln29iTVUCIjdkJJKExDbAPFcqJdPEMpd2AwF5TBWaFKxBeJ6qOHIqaMbmjrcsBUw2AwNh7rKAEeaBaWOMiD2BeJvQOxOyFBuaFJJwZZU0MBWaHCIo0sABBgAetA4Jx5t/ToAAAAASUVORK5CYII="
  18. let data = [{
  19. name: "北京",
  20. value: [116.24, 39.55, 100]
  21. },
  22. {
  23. name: "深圳",
  24. value: [114.271522, 22.753644]
  25. },
  26. {
  27. name: "重庆",
  28. value: [106.54, 29.59]
  29. },
  30. {
  31. name: "浙江",
  32. value: [120.19, 30.26]
  33. },
  34. {
  35. name: "上海",
  36. value: [121.4648, 31.2891]
  37. },
  38. ]
  39. let LableData = [
  40. {
  41. name: "北京",
  42. coords: [
  43. [116.24, 39.55, 100],
  44. [120.24, 46.55, 100]
  45. ], // 线条位置[开始位置,结束位置]
  46. value: [1021, 120]
  47. },
  48. {
  49. name: "深圳",
  50. coords: [
  51. [114.271522, 22.753644],
  52. [118.24, 18.55, 100]
  53. ], // 线条位置[开始位置,结束位置]
  54. value: [1021, 120]
  55. },
  56. {
  57. name: "重庆",
  58. coords: [
  59. [106.54, 29.59],
  60. [104.24, 35.55]
  61. ], // 线条位置[开始位置,结束位置]
  62. value: [1021, 120]
  63. },
  64. {
  65. name: "浙江",
  66. coords: [
  67. [120.19, 30.26],
  68. [125.24, 27.55, 100]
  69. ], // 线条位置[开始位置,结束位置]
  70. value: [1021, 120]
  71. },
  72. {
  73. name: "上海",
  74. coords: [
  75. [121.4648, 31.2891],
  76. [122.4648, 32.2891]
  77. ], // 线条位置[开始位置,结束位置]
  78. value: [1201, 60]
  79. },
  80. ];
  81. option = {
  82. /*backgroundColor: '#000f1e',*/
  83. geo: {
  84. map: 'china',
  85. aspectScale: 0.85,
  86. layoutCenter: ["50%", "50%"], //地图位置
  87. layoutSize: '100%',
  88. itemStyle: {
  89. normal: {
  90. shadowColor: '#276fce',
  91. shadowOffsetX: 0,
  92. shadowOffsetY: 15,
  93. opacity: 0.5,
  94. },
  95. emphasis: {
  96. areaColor: '#276fce',
  97. }
  98. },
  99. regions: [{
  100. name: '南海诸岛',
  101. itemStyle: {
  102. areaColor: 'rgba(0, 10, 52, 1)',
  103. borderColor: 'rgba(0, 10, 52, 1)',
  104. normal: {
  105. opacity: 0,
  106. label: {
  107. show: false,
  108. color: "#009cc9",
  109. }
  110. },
  111. },
  112. label: {
  113. show: false,
  114. color: '#FFFFFF',
  115. fontSize: 12,
  116. },
  117. }],
  118. },
  119. series: [
  120. // 常规地图
  121. {
  122. type: 'map',
  123. mapType: 'china',
  124. aspectScale: 0.85,
  125. layoutCenter: ["50%", "50%"], //地图位置
  126. layoutSize: '100%',
  127. zoom: 1, //当前视角的缩放比例
  128. // roam: true, //是否开启平游或缩放
  129. scaleLimit: { //滚轮缩放的极限控制
  130. min: 1,
  131. max: 2
  132. },
  133. itemStyle: {
  134. normal: {
  135. areaColor: '#0c274b',
  136. borderColor: '#1cccff',
  137. borderWidth: 1.5
  138. },
  139. emphasis: {
  140. areaColor: '#02102b',
  141. label: {
  142. color: "#fff"
  143. }
  144. }
  145. },
  146. },
  147. { //首都星图标
  148. name: '首都',
  149. type: 'scatter',
  150. coordinateSystem: 'geo',
  151. data: [{
  152. name: '首都',
  153. value: [116.24, 41.55, 100],
  154. }, ],
  155. symbol: iconRQ,
  156. symbolSize: 20,
  157. label: {
  158. normal: {
  159. show: false,
  160. },
  161. emphasis: {
  162. show: false
  163. }
  164. },
  165. },
  166. // 区域散点图
  167. {
  168. type: 'effectScatter',
  169. coordinateSystem: 'geo',
  170. zlevel: 2,
  171. symbolSize: 10,
  172. rippleEffect: { //坐标点动画
  173. period: 3,
  174. scale: 5,
  175. brushType: 'fill'
  176. },
  177. label: {
  178. normal: {
  179. show: true,
  180. position: 'right',
  181. formatter: '{b}',
  182. color: '#b3e2f2',
  183. fontWeight: "bold",
  184. fontSize: 16
  185. }
  186. },
  187. data: data,
  188. itemStyle: { //坐标点颜色
  189. normal: {
  190. show: true,
  191. color: '#ff8003',
  192. shadowBlur: 20,
  193. shadowColor: '#fff'
  194. },
  195. emphasis: {
  196. areaColor: '#f00'
  197. }
  198. },
  199. },
  200. /*{
  201. name: 'lable',
  202. type: 'scatter',
  203. coordinateSystem: 'geo',
  204. symbol: 'pin',
  205. symbolSize: [50,50],
  206. label: {
  207. normal: {
  208. show: true,
  209. textStyle: {
  210. color: '#fff',
  211. fontSize: 9,
  212. },
  213. formatter (value){
  214. return value.data.value[1]
  215. }
  216. }
  217. },
  218. itemStyle: {
  219. normal: {
  220. color: '#D8BC37', //标志颜色
  221. }
  222. },
  223. data: data,
  224. showEffectOn: 'render',
  225. rippleEffect: {
  226. brushType: 'stroke'
  227. },
  228. hoverAnimation: true,
  229. zlevel: 1
  230. },*/
  231. {
  232. type: 'lines',
  233. zlevel: 3,
  234. symbol: 'circle',
  235. symbolSize: [5, 5],
  236. color: '#ff8003',
  237. opacity: 1,
  238. label: {
  239. show: true,
  240. padding: [10, 20],
  241. color: '#fff',
  242. backgroundColor: "#1a3961",
  243. borderColor: '#aee9fb',
  244. borderWidth: 1,
  245. borderRadius: 6,
  246. formatter(params) {
  247. let arr = [params.name, "废水污染:" + params.value[1] + "家", "废气污染:" + params.value[0] + "家"];
  248. return arr.join("\n")
  249. },
  250. textStyle: {
  251. align: 'left',
  252. lineHeight: 20,
  253. }
  254. /* normal: {
  255. textStyle: {
  256. color: '#fff',
  257. fontSize: 9,
  258. },
  259. formatter (value){
  260. return value.data.value[2]
  261. },
  262. }*/
  263. },
  264. lineStyle: {
  265. type: 'solid',
  266. color: '#fff',
  267. width: 0.5,
  268. opacity: 1,
  269. },
  270. data: LableData,
  271. },
  272. ]
  273. };
  274. myChart.on('click', function(params) {
  275. console.log(params);
  276. });
  277. myChart.setOption(option);
  278. window.addEventListener("resize",function(){
  279. myChart.resize();
  280. });
  281. }
  282. function leidatu(){
  283. // var imgPath = ['http://bmob-cdn-15355.b0.upaiyun.com/2017/12/01/bee4341c4089af7980b87074a77479ad.png']
  284. var myChart = echarts.init(document.getElementById('leida'));
  285. option = {
  286. color: ['#00c2ff', '#f9cf67', '#e92b77'],
  287. legend: {
  288. show: true,
  289. // icon: 'circle',//图例形状
  290. bottom: 0,
  291. center: 0,
  292. itemWidth: 14, // 图例标记的图形宽度。[ default: 25 ]
  293. itemHeight: 14, // 图例标记的图形高度。[ default: 14 ]
  294. itemGap: 21, // 图例每项之间的间隔。[ default: 10 ]横向布局时为水平间隔,纵向布局时为纵向间隔。
  295. textStyle: {
  296. fontSize: 12,
  297. color: '#ade3ff'
  298. },
  299. data: ['2016', '2017', '2018'],
  300. },
  301. radar: [{
  302. indicator: [{
  303. text: '重庆市',
  304. max: 100
  305. },
  306. {
  307. text: '北京市',
  308. max: 100
  309. },
  310. {
  311. text: '上海市',
  312. max: 100
  313. },
  314. {
  315. text: '广东省',
  316. max: 100
  317. },
  318. {
  319. text: '浙江省',
  320. max: 100
  321. }
  322. ],
  323. textStyle: {
  324. color: 'red'
  325. },
  326. center: ['50%', '50%'],
  327. radius: 60,
  328. startAngle: 90,
  329. splitNumber: 3,
  330. orient: 'horizontal', // 图例列表的布局朝向,默认'horizontal'为横向,'vertical'为纵向.
  331. // shape: 'circle',
  332. // backgroundColor: {
  333. // image:imgPath[0]
  334. // },
  335. name: {
  336. formatter: '{value}',
  337. textStyle: {
  338. fontSize: 12, //外圈标签字体大小
  339. color: '#5b81cb' //外圈标签字体颜色
  340. }
  341. },
  342. splitArea: { // 坐标轴在 grid 区域中的分隔区域,默认不显示。
  343. show: true,
  344. areaStyle: { // 分隔区域的样式设置。
  345. color: ['#141c42', '#141c42'], // 分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
  346. }
  347. },
  348. // axisLabel:{//展示刻度
  349. // show: true
  350. // },
  351. axisLine: { //指向外圈文本的分隔线样式
  352. lineStyle: {
  353. color: '#153269'
  354. }
  355. },
  356. splitLine: {
  357. lineStyle: {
  358. color: '#113865', // 分隔线颜色
  359. width: 1, // 分隔线线宽
  360. }
  361. }
  362. }, ],
  363. series: [{
  364. name: '雷达图',
  365. type: 'radar',
  366. itemStyle: {
  367. emphasis: {
  368. lineStyle: {
  369. width: 4
  370. }
  371. }
  372. },
  373. data: [{
  374. name: '2016',
  375. value: [85, 65, 55, 90, 82],
  376. areaStyle: {
  377. normal: { // 单项区域填充样式
  378. color: {
  379. type: 'linear',
  380. x: 0, //右
  381. y: 0, //下
  382. x2: 1, //左
  383. y2: 1, //上
  384. colorStops: [{
  385. offset: 0,
  386. color: '#00c2ff'
  387. }, {
  388. offset: 0.5,
  389. color: 'rgba(0,0,0,0)'
  390. }, {
  391. offset: 1,
  392. color: '#00c2ff'
  393. }],
  394. globalCoord: false
  395. },
  396. opacity: 1 // 区域透明度
  397. }
  398. },
  399. symbolSize: 2.5, // 单个数据标记的大小,可以设置成诸如 10 这样单一的数字,也可以用数组分开表示宽和高,例如 [20, 10] 表示标记宽为20,高为10。
  400. label: { // 单个拐点文本的样式设置
  401. normal: {
  402. show: true, // 单个拐点文本的样式设置。[ default: false ]
  403. position: 'top', // 标签的位置。[ default: top ]
  404. distance: 2, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。[ default: 5 ]
  405. color: '#6692e2', // 文字的颜色。如果设置为 'auto',则为视觉映射得到的颜色,如系列色。[ default: "#fff" ]
  406. fontSize: 14, // 文字的字体大小
  407. formatter:function(params) {
  408. return params.value;
  409. }
  410. }
  411. },
  412. itemStyle: {
  413. normal: { //图形悬浮效果
  414. borderColor: '#00c2ff',
  415. borderWidth: 2.5
  416. }
  417. },
  418. // lineStyle: {
  419. // normal: {
  420. // opacity: 0.5// 图形透明度
  421. // }
  422. // }
  423. }, {
  424. name: '2017',
  425. value: [50, 20, 45, 30, 75],
  426. symbolSize: 2.5,
  427. itemStyle: {
  428. normal: {
  429. borderColor: '#f9cf67',
  430. borderWidth: 2.5,
  431. }
  432. },
  433. areaStyle: {
  434. normal: { // 单项区域填充样式
  435. color: {
  436. type: 'linear',
  437. x: 0, //右
  438. y: 0, //下
  439. x2: 1, //左
  440. y2: 1, //上
  441. colorStops: [{
  442. offset: 0,
  443. color: '#f9cf67'
  444. }, {
  445. offset: 0.5,
  446. color: 'rgba(0,0,0,0)'
  447. }, {
  448. offset: 1,
  449. color: '#f9cf67'
  450. }],
  451. globalCoord: false
  452. },
  453. opacity: 1 // 区域透明度
  454. }
  455. },
  456. // lineStyle: {
  457. // normal: {
  458. // opacity: 0.5// 图形透明度
  459. // }
  460. // }
  461. }, {
  462. name: '2018',
  463. value: [37, 80, 12, 50, 25],
  464. symbolSize: 2.5,
  465. itemStyle: {
  466. normal: {
  467. borderColor: '#e92b77',
  468. borderWidth: 2.5,
  469. }
  470. },
  471. areaStyle: {
  472. normal: { // 单项区域填充样式
  473. color: {
  474. type: 'linear',
  475. x: 0, //右
  476. y: 0, //下
  477. x2: 1, //左
  478. y2: 1, //上
  479. colorStops: [{
  480. offset: 0,
  481. color: '#e92b77'
  482. }, {
  483. offset: 0.5,
  484. color: 'rgba(0,0,0,0)'
  485. }, {
  486. offset: 1,
  487. color: '#e92b77'
  488. }],
  489. globalCoord: false
  490. },
  491. opacity: 1 // 区域透明度
  492. }
  493. }
  494. }]
  495. }, ]
  496. };
  497. myChart.setOption(option);
  498. }
  499. function wuran(){
  500. var myChart = echarts.init(document.getElementById('wuran'));
  501. var salvProName =["企业总数","废气企业","废水企业","铅污染","铬污染"];
  502. var salvProValue =[117,74,72,67,55];
  503. var salvProMax =[];//背景按最大值
  504. for (let i = 0; i < salvProValue.length; i++) {
  505. salvProMax.push(salvProValue[0])
  506. }
  507. option = {
  508. grid: {
  509. left: '2%',
  510. right: '2%',
  511. bottom: '-6%',
  512. top: '8%',
  513. containLabel: true
  514. },
  515. tooltip: {
  516. trigger: 'axis',
  517. axisPointer: {
  518. type: 'none'
  519. },
  520. formatter: function(params) {
  521. return params[0].name + ' : ' + params[0].value
  522. }
  523. },
  524. xAxis: {
  525. show: false,
  526. type: 'value'
  527. },
  528. yAxis: [{
  529. type: 'category',
  530. inverse: true,
  531. axisLabel: {
  532. show: true,
  533. textStyle: {
  534. color: '#fff'
  535. },
  536. },
  537. splitLine: {
  538. show: false
  539. },
  540. axisTick: {
  541. show: false
  542. },
  543. axisLine: {
  544. show: false
  545. },
  546. data: salvProName
  547. }, {
  548. type: 'category',
  549. inverse: true,
  550. axisTick: 'none',
  551. axisLine: 'none',
  552. show: true,
  553. axisLabel: {
  554. textStyle: {
  555. color: '#ffffff',
  556. fontSize: '12'
  557. },
  558. },
  559. data:salvProValue
  560. }],
  561. series: [{
  562. name: '值',
  563. type: 'bar',
  564. zlevel: 1,
  565. itemStyle: {
  566. normal: {
  567. barBorderRadius: 30,
  568. color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
  569. offset: 0,
  570. color: 'rgb(57,89,255,1)'
  571. }, {
  572. offset: 1,
  573. color: 'rgb(46,200,207,1)'
  574. }]),
  575. },
  576. },
  577. barWidth: 10,
  578. data: salvProValue
  579. },
  580. {
  581. name: '背景',
  582. type: 'bar',
  583. barWidth: 10,
  584. barGap: '-100%',
  585. data: salvProMax,
  586. itemStyle: {
  587. normal: {
  588. color: 'rgba(24,31,68,1)',
  589. barBorderRadius: 30,
  590. }
  591. },
  592. },
  593. ]
  594. };
  595. myChart.setOption(option);
  596. }
  597. function huaxing(){
  598. var myChart = echarts.init(document.getElementById('huaxing'));
  599. var dataStyle = {
  600. normal: {
  601. label: {
  602. show: false
  603. },
  604. labelLine: {
  605. show: false
  606. },
  607. shadowBlur: 0,
  608. shadowColor: '#203665'
  609. }
  610. };
  611. option = {
  612. series: [{
  613. name: '第一个圆环',
  614. type: 'pie',
  615. clockWise: false,
  616. radius: [45, 55],
  617. itemStyle: dataStyle,
  618. hoverAnimation: false,
  619. center: ['15%', '50%'],
  620. data: [{
  621. value: 25,
  622. label: {
  623. normal: {
  624. rich: {
  625. a: {
  626. color: '#3a7ad5',
  627. align: 'center',
  628. fontSize: 14,
  629. fontWeight: "bold"
  630. },
  631. b: {
  632. color: '#fff',
  633. align: 'center',
  634. fontSize: 12
  635. }
  636. },
  637. formatter: function(params){
  638. return "{b|饮用水质}\n\n"+"{a|"+params.value+"个}"+"\n\n{b|增长2%}";
  639. },
  640. position: 'center',
  641. show: true,
  642. textStyle: {
  643. fontSize: '12',
  644. fontWeight: 'normal',
  645. color: '#fff'
  646. }
  647. }
  648. },
  649. itemStyle: {
  650. normal: {
  651. color: '#2c6cc4',
  652. shadowColor: '#2c6cc4',
  653. shadowBlur: 0
  654. }
  655. }
  656. }, {
  657. value: 75,
  658. name: 'invisible',
  659. itemStyle: {
  660. normal: {
  661. color: '#24375c'
  662. },
  663. emphasis: {
  664. color: '#24375c'
  665. }
  666. }
  667. }]
  668. }, {
  669. name: '第二个圆环',
  670. type: 'pie',
  671. clockWise: false,
  672. radius: [45, 55],
  673. itemStyle: dataStyle,
  674. hoverAnimation: false,
  675. center: ['50%', '50%'],
  676. data: [{
  677. value: 50,
  678. label: {
  679. normal: {
  680. rich: {
  681. a: {
  682. color: '#d03e93',
  683. align: 'center',
  684. fontSize: 14,
  685. fontWeight: "bold"
  686. },
  687. b: {
  688. color: '#fff',
  689. align: 'center',
  690. fontSize: 12
  691. }
  692. },
  693. formatter: function(params){
  694. return "{b|生活用水}\n\n"+"{a|"+params.value+"个}"+"\n\n{b|增长2%}";
  695. },
  696. position: 'center',
  697. show: true,
  698. textStyle: {
  699. fontSize: '12',
  700. fontWeight: 'normal',
  701. color: '#fff'
  702. }
  703. }
  704. },
  705. itemStyle: {
  706. normal: {
  707. color: '#ef45ac',
  708. shadowColor: '#ef45ac',
  709. shadowBlur: 0
  710. }
  711. }
  712. }, {
  713. value: 50,
  714. name: 'invisible',
  715. itemStyle: {
  716. normal: {
  717. color: '#412a4e'
  718. },
  719. emphasis: {
  720. color: '#412a4e'
  721. }
  722. }
  723. }]
  724. }, {
  725. name: '第三个圆环',
  726. type: 'pie',
  727. clockWise: false,
  728. radius: [45, 55],
  729. itemStyle: dataStyle,
  730. hoverAnimation: false,
  731. center: ['85%', '50%'],
  732. data: [{
  733. value: 75,
  734. label: {
  735. normal: {
  736. rich: {
  737. a: {
  738. color: '#603dd0',
  739. align: 'center',
  740. fontSize: 14,
  741. fontWeight: "bold"
  742. },
  743. b: {
  744. color: '#fff',
  745. align: 'center',
  746. fontSize: 12
  747. }
  748. },
  749. formatter: function(params){
  750. return "{b|自来水}\n\n"+"{a|"+params.value+"个}"+"\n\n{b|增长2%}";
  751. },
  752. position: 'center',
  753. show: true,
  754. textStyle: {
  755. fontSize: '12',
  756. fontWeight: 'normal',
  757. color: '#fff'
  758. }
  759. }
  760. },
  761. itemStyle: {
  762. normal: {
  763. color: '#613fd1',
  764. shadowColor: '#613fd1',
  765. shadowBlur: 0
  766. }
  767. }
  768. }, {
  769. value: 25,
  770. name: 'invisible',
  771. itemStyle: {
  772. normal: {
  773. color: '#453284'
  774. },
  775. emphasis: {
  776. color: '#453284'
  777. }
  778. }
  779. }]
  780. }]
  781. }
  782. myChart.setOption(option);
  783. }
  784. function zhexian() {
  785. var myChart = echarts.init(document.getElementById('zhexian'));
  786. dataText = [{
  787. name: '上游流速',
  788. type: 'line',
  789. smooth: true,
  790. symbolSize: 8,
  791. data: [127, 224, 120, 278, 227, 237],
  792. barWidth: '30%',
  793. itemStyle: {
  794. normal: {
  795. color: '#f0c725'
  796. }
  797. }
  798. }, {
  799. name: '下游流速',
  800. type: 'line',
  801. smooth: true,
  802. symbolSize: 8,
  803. data: [27, 124, 70, 178, 127, 157],
  804. barWidth: '30%',
  805. itemStyle: {
  806. normal: {
  807. color: '#16f892'
  808. }
  809. }
  810. },
  811. {
  812. name: '平均流速',
  813. type: 'line',
  814. smooth: true,
  815. symbolSize: 8,
  816. data: [127, 74, 120, 99, 130, 355],
  817. barWidth: '30%',
  818. itemStyle: {
  819. normal: {
  820. color: '#0BE3FF'
  821. }
  822. }
  823. }
  824. ]
  825. dataObj = {
  826. year: ['2015', '2016', '2017', '2018', '2019', '2020'],
  827. data: {
  828. value: [{
  829. name: '上游流速',
  830. value: [127, 224, 250, 278, 227, 355]
  831. }, {
  832. name: '下游流速',
  833. value: [27, 124, 70, 178, 127, 157]
  834. }, {
  835. name: '平均流速',
  836. value: [127, 74, 120, 99, 130, 50]
  837. }]
  838. }
  839. }
  840. let dataArr = []
  841. dataObj.data.value.map(item => {
  842. let datachild = []
  843. let newArr = {
  844. name: item.name,
  845. type: 'line',
  846. smooth: true,
  847. symbolSize: 8,
  848. data: item.value,
  849. barWidth: '30%',
  850. itemStyle: {
  851. normal: {
  852. color: item.name === '上游流速' ? '#f0c725' : item.name === '下游流速' ? '#0BE3FF' : '#16f892'
  853. }
  854. }
  855. }
  856. dataArr.push(newArr)
  857. })
  858. option = {
  859. color: ['#f0c725', '#16f892'],
  860. title: {
  861. left: 'center',
  862. text: '',
  863. textStyle: {
  864. color: '#FFFFFF',
  865. fontSize: '14',
  866. }
  867. },
  868. tooltip: {
  869. trigger: 'axis',
  870. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  871. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  872. }
  873. },
  874. legend: {
  875. x: 'center',
  876. top: '25',
  877. textStyle: {
  878. color: '#c1cadf',
  879. "fontSize": 14
  880. }
  881. },
  882. grid: {
  883. left: '6%',
  884. right: '4%',
  885. top: '25%',
  886. bottom: '3%',
  887. containLabel: true
  888. },
  889. toolbox: {
  890. show: true,
  891. orient: 'vertical',
  892. x: 'right',
  893. y: 'center'
  894. },
  895. xAxis: [{
  896. type: 'category',
  897. boundaryGap: false,
  898. data: dataObj.year,
  899. axisLine: {
  900. lineStyle: {
  901. color: 'rgba(240,199,37,0.5)'
  902. }
  903. },
  904. axisLabel: {
  905. interval: 0,
  906. color: '#c1cadf',
  907. fontSize: '15'
  908. }
  909. }],
  910. yAxis: [{
  911. type: 'value',
  912. name: '(m3)',
  913. nameTextStyle: {
  914. color: '#c1cadf',
  915. align: 'right',
  916. lineHeight: 10
  917. },
  918. axisLine: {
  919. lineStyle: {
  920. color: 'rgba(240,199,37,0.5)'
  921. }
  922. },
  923. axisLabel: {
  924. interval: 0,
  925. color: '#c1cadf',
  926. fontSize: '15'
  927. },
  928. splitLine: {
  929. show: false
  930. }
  931. }],
  932. series: dataArr
  933. };
  934. /*var myChart = echarts.init(document.getElementById('channel_handle_detail'));
  935. myChart.clear();
  936. if(data.handleTimeData.length>0){
  937. myChart.setOption(option);
  938. }else{
  939. noDataTip($("#channel_handle_detail"));
  940. }*/
  941. // 使用刚指定的配置项和数据显示图表。
  942. myChart.setOption(option);
  943. window.addEventListener("resize",function(){
  944. myChart.resize();
  945. });
  946. }