echartConfig.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. let pieChartOption = {
  2. tooltip: {
  3. trigger: 'item'
  4. },
  5. color: ['#61D9AC', '#FF948C', '#7EA4FF', '#FFB436', '#52A9FF', '#Fe941C', '#FFe426', '#7F8322'],
  6. legend: {
  7. top: '5%',
  8. right: '20%',
  9. orient: 'vertical',
  10. },
  11. series: [
  12. {
  13. name: '宗地数',
  14. type: 'pie',
  15. radius: ['40%', '70%'],
  16. avoidLabelOverlap: false,
  17. itemStyle: {
  18. borderRadius: 10,
  19. borderColor: '#fff',
  20. borderWidth: 2
  21. },
  22. center: ['32%', '42%'],
  23. label: {
  24. show: false,
  25. position: 'center'
  26. },
  27. emphasis: {
  28. label: {
  29. show: true,
  30. fontSize: '40',
  31. fontWeight: 'bold'
  32. }
  33. },
  34. labelLine: {
  35. show: false
  36. },
  37. data: [
  38. {value: 0, name: '东港镇'},
  39. {value: 0, name: '锡北镇'},
  40. {value: 0, name: '羊尖镇'},
  41. {value: 0, name: '东北塘街道'},
  42. {value: 0, name: '开发区'},
  43. {value: 0, name: '商务区'},
  44. {value: 0, name: '东亭街道'},
  45. {value: 0, name: '鹅湖镇'},
  46. ]
  47. }
  48. ],
  49. setData(data) {
  50. this.series[0].data.map(item=>{
  51. data.map(i=>{
  52. if(item.name==i.name){
  53. item.value=i.value
  54. }
  55. })
  56. });
  57. },
  58. /**
  59. * 东港镇 锡北镇 羊尖镇 东北塘 开发区 商务区 东亭街道 鹅湖镇
  60. *
  61. * @param data
  62. */
  63. setJdData(data) {
  64. for (let i = 0; i < 8; i++) {
  65. if (i >= data.length) {
  66. data.push(0)
  67. } else if (!data[i]) {
  68. data[i] = 0
  69. }
  70. }
  71. this.series[0].data[0] = {value: data[0], name: '东港镇'};
  72. this.series[0].data[1] = {value: data[1], name: '锡北镇'};
  73. this.series[0].data[2] = {value: data[2], name: '羊尖镇'};
  74. this.series[0].data[3] = {value: data[3], name: '东北塘街道'};
  75. this.series[0].data[4] = {value: data[4], name: '开发区'};
  76. this.series[0].data[5] = {value: data[5], name: '商务区'};
  77. this.series[0].data[6] = {value: data[6], name: '东亭街道'};
  78. this.series[0].data[7] = {value: data[7], name: '鹅湖镇'};
  79. }
  80. };
  81. export {
  82. pieChartOption,
  83. barChartOption,
  84. xiShanOption
  85. };
  86. let barChartOption = {
  87. title: {
  88. x: 13,
  89. y: 20,
  90. text: '{a|} {b|可利用资源区域分布}',
  91. textStyle: {
  92. rich: {
  93. a: {
  94. width: 4,
  95. height: 16,
  96. backgroundColor: '#2D9AFF',
  97. borderRadius: 2,
  98. },
  99. b: {
  100. fontSize: '16',
  101. fontFamily: ' MicrosoftYaHeiSemibold',
  102. fontWeight: 'normal',
  103. color: '#333333',
  104. }
  105. }
  106. }
  107. },
  108. legend: {
  109. data: ['立即可用', '近期可用', '供而未用', '用而未足', '低效产出'],
  110. icon: 'rect',
  111. textStyle: {
  112. color: '#000'
  113. },
  114. top: '8%',
  115. right: '6%'
  116. },
  117. tooltip: {
  118. trigger: 'axis',
  119. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  120. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  121. },
  122. },
  123. grid: {
  124. left: '2%',
  125. right: '6%',
  126. bottom: '5%',
  127. top: '25%',
  128. containLabel: true
  129. },
  130. xAxis: [{
  131. type: 'category',
  132. data: ['东港镇', '锡北镇', '羊尖镇', '东北塘街道', '开发区', '商务区', '东亭街道', '鹅湖镇'],
  133. axisTick: {
  134. show: false,
  135. alignWithLabel: true
  136. },
  137. axisLabel: {
  138. interval: 0,
  139. textStyle: {
  140. color: 'rgba(0,0,0,0.8)'
  141. },
  142. fontSize: '12',
  143. rotate: 0,
  144. show: true,
  145. },
  146. axisLine: {
  147. show: true,
  148. lineStyle: {
  149. type: 'dotted',
  150. color: '#CCCCCC'
  151. }
  152. },
  153. splitLine: {
  154. show: true,
  155. lineStyle: {
  156. type: 'dashed',
  157. }
  158. },
  159. }],
  160. yAxis: {
  161. axisLine: {
  162. show: false
  163. },
  164. axisLabel: {
  165. textStyle: {
  166. color: '#000'
  167. },
  168. fontSize: '12'
  169. },
  170. show: true,
  171. type: 'value',
  172. splitLine: {
  173. show: true,
  174. lineStyle: {
  175. type: 'dashed'
  176. }
  177. },
  178. nameTextStyle: {
  179. color: 'rgba(255,255,255,1.0)'
  180. },
  181. axisTick: {
  182. show: false,
  183. alignWithLabel: true
  184. },
  185. },
  186. series: [{
  187. name: '立即可用',
  188. type: 'bar',
  189. barWidth: 13,
  190. label: {
  191. normal: {
  192. show: false,
  193. position: 'top',
  194. formatter: function (params) {
  195. return params.data.value;
  196. },
  197. textStyle: {
  198. color: 'rgba(0,0,0,1)'
  199. },
  200. fontSize: '13'
  201. }
  202. },
  203. itemStyle: {
  204. normal: {
  205. color: "#59AEF1"
  206. }
  207. },
  208. data: [48, 24, 36, 22, 66, 16, 26, 13]
  209. },
  210. {
  211. name: '近期可用',
  212. type: 'bar',
  213. barWidth: 13,
  214. label: {
  215. normal: {
  216. show: false,
  217. position: 'top',
  218. formatter: function (params) {
  219. return params.data.value;
  220. },
  221. textStyle: {
  222. color: 'rgba(0,0,0,0.8)'
  223. },
  224. fontSize: '16'
  225. }
  226. },
  227. itemStyle: {
  228. normal: {
  229. color: "#61D9AC"
  230. }
  231. },
  232. data: [21, 18, 18, 16, 11, 18, 21, 15]
  233. },
  234. {
  235. name: '供而未用',
  236. type: 'bar',
  237. barWidth: 13,
  238. label: {
  239. normal: {
  240. show: false,
  241. position: 'top',
  242. formatter: function (params) {
  243. return params.data.value;
  244. },
  245. textStyle: {
  246. color: 'rgba(0,0,0,0.8)'
  247. },
  248. fontSize: '16'
  249. }
  250. },
  251. itemStyle: {
  252. normal: {
  253. color: "#FFB436"
  254. }
  255. },
  256. data: [28, 58, 38, 66, 31, 58, 81, 52]
  257. },
  258. {
  259. name: '用而未足',
  260. type: 'bar',
  261. barWidth: 13,
  262. label: {
  263. normal: {
  264. show: false,
  265. position: 'top',
  266. formatter: function (params) {
  267. return params.data.value;
  268. },
  269. textStyle: {
  270. color: 'rgba(0,0,0,0.8)'
  271. },
  272. fontSize: '16'
  273. }
  274. },
  275. itemStyle: {
  276. normal: {
  277. color: "#7EA4FF"
  278. }
  279. },
  280. data: [28, 58, 38, 66, 31, 58, 81, 23]
  281. },
  282. {
  283. name: '低效产出',
  284. type: 'bar',
  285. barWidth: 13,
  286. label: {
  287. normal: {
  288. show: false,
  289. position: 'top',
  290. formatter: function (params) {
  291. return params.data.value;
  292. },
  293. textStyle: {
  294. color: 'rgba(0,0,0,0.8)'
  295. },
  296. fontSize: '16'
  297. }
  298. },
  299. itemStyle: {
  300. normal: {
  301. color: "#FF948C"
  302. }
  303. },
  304. data: [28, 58, 38, 66, 31, 58, 81, 32]
  305. }
  306. ],
  307. setTitleText(title) {
  308. this.title.text = '{a|} {b|' + title + '}'
  309. },
  310. setSubtTitle(data) {
  311. this.xAxis.data = data
  312. },
  313. setData(titleArray, dataArray, colorArray) {
  314. let colors = ["#59AEF1", "#61D9AC", "#FFB436", "#7EA4FF", "#FF948C"];
  315. if (colorArray) {
  316. colors = colorArray;
  317. }
  318. this.legend.data = titleArray
  319. this.series = [];
  320. for (let i = 0; i < titleArray.length; i++) {
  321. let color = '';
  322. if (i < colors.length) {
  323. color = colors[i]
  324. } else {
  325. color = colors[i % colors.length]
  326. }
  327. let seriesData = {
  328. name: titleArray[i],
  329. type: 'bar',
  330. barWidth: 13,
  331. label: {
  332. normal: {
  333. show: false,
  334. position: 'top',
  335. formatter: function (params) {
  336. return params.data.value;
  337. },
  338. textStyle: {
  339. color: 'rgba(0,0,0,1)'
  340. },
  341. fontSize: '13'
  342. }
  343. },
  344. itemStyle: {
  345. normal: {
  346. color: color
  347. }
  348. },
  349. data: dataArray[i]
  350. }
  351. this.series.push(seriesData)
  352. }
  353. }
  354. };
  355. let xiShanOption = {
  356. tooltip: {
  357. trigger: 'item',
  358. formatter: '{b}:{c}m²'
  359. },
  360. visualMap: {
  361. min: 0,
  362. max: 3656457.92289,
  363. left: '20',
  364. top: 'bottom',
  365. text: ['高', '低'], // 文本,默认为数值文本
  366. inRange: {
  367. color: ['lightskyblue', 'yellow', 'orangered']
  368. },
  369. textStyle: {
  370. fontSize:16,
  371. },
  372. calculable: true
  373. },
  374. toolbox: {
  375. show: false,
  376. left: 'left',
  377. top: 'top',
  378. feature: {
  379. dataView: {readOnly: false},
  380. restore: {},
  381. saveAsImage: {}
  382. }
  383. },
  384. series: [
  385. {
  386. type: 'map',
  387. mapType: 'XiShanQu',
  388. selectedMode: 'single',
  389. roam: false,
  390. itemStyle: {
  391. normal: {
  392. areaColor: '#fdefdd',
  393. shadowBlur: 1,
  394. borderWidth: 0.5,//设置外层边框
  395. borderColor: '#347b68',//轮廓颜色
  396. shadowColor: '#a9c5c5'//轮廓阴影颜色
  397. },
  398. emphasis: {
  399. areaColor: '#04fc0f',
  400. shadowOffsetY: 1.5,
  401. shadowOffsetX: 1.5,
  402. shadowColor:'#1227de',
  403. shadowBlur: 10,
  404. },
  405. },
  406. label: {
  407. normal: {
  408. show: true,
  409. textStyle: {
  410. fontSize:16,
  411. },
  412. },
  413. },
  414. data: [
  415. {"name": "某某区", "value": 0},
  416. {"name": "商务区", "value": 0},
  417. {"name": "锡北镇", "value": 0},
  418. {"name": "东港镇", "value": 0},
  419. {"name": "鹅湖镇", "value": 0},
  420. {"name": "东亭街道", "value": 0},
  421. {"name": "东北塘街道", "value": 0},
  422. {"name": "羊尖镇", "value": 0},
  423. {"name": "开发区", "value": 0}
  424. ]
  425. }
  426. ],
  427. setData(data) {
  428. if (data) {
  429. this.series[0].data.map(item=>{
  430. item.value=0;
  431. data.map(i=>{
  432. if(item.name==i.name){
  433. item.value=i.value
  434. }
  435. })
  436. });
  437. let min = 0;
  438. let max = 0;
  439. data.map(item => {
  440. if (item.name&&min >= parseFloat(item.value)) {
  441. min = parseFloat(item.value);
  442. }
  443. if (item.name&&max <= parseFloat(item.value)) {
  444. max = parseFloat(item.value);
  445. }
  446. })
  447. this.visualMap.min = min;
  448. this.visualMap.max = max;
  449. }
  450. },
  451. setOnlyData(data) {
  452. if (data) {
  453. this.series[0].data=data;
  454. let min = 0;
  455. let max = 0;
  456. data.map(item => {
  457. if (item.name&&min >= parseFloat(item.value)) {
  458. min = parseFloat(item.value);
  459. }
  460. if (item.name&&max <= parseFloat(item.value)) {
  461. max = parseFloat(item.value);
  462. }
  463. })
  464. this.visualMap.min = min;
  465. this.visualMap.max = max;
  466. }
  467. },
  468. /**
  469. * 东港镇 锡北镇 羊尖镇 东北塘街道 开发区 商务区 东亭街道 鹅湖镇
  470. *
  471. * @param data
  472. */
  473. setJdData(data) {
  474. for (let i = 0; i < 8; i++) {
  475. if (i >= data.length) {
  476. data.push(0)
  477. } else if (!data[i]) {
  478. data[i] = 0
  479. }
  480. }
  481. this.series[0].data[0] = {value: data[0], name: '东港镇'};
  482. this.series[0].data[1] = {value: data[1], name: '锡北镇'};
  483. this.series[0].data[2] = {value: data[2], name: '羊尖镇'};
  484. this.series[0].data[3] = {value: data[3], name: '东北塘街道'};
  485. this.series[0].data[4] = {value: data[4], name: '开发区'};
  486. this.series[0].data[5] = {value: data[5], name: '商务区'};
  487. this.series[0].data[6] = {value: data[6], name: '东亭街道'};
  488. this.series[0].data[7] = {value: data[7], name: '鹅湖镇'};
  489. let min = 0;
  490. let max = 0;
  491. this.series[0].map(item => {
  492. if (min > parseFloat(item.value)) {
  493. min = parseFloat(item.value);
  494. }
  495. if (max < parseFloat(item.value)) {
  496. max = parseFloat(item.value);
  497. }
  498. })
  499. this.visualMap.min = min;
  500. this.visualMap.max = max;
  501. }
  502. }