index.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293
  1. <!-- 首页模块 首页面 -->
  2. <template>
  3. <div id="index" ref="appRef">
  4. <!-- <dv-loading v-show="loading">Loading...</dv-loading> -->
  5. <div class="host-body">
  6. <div>
  7. <!-- 顶部title部分 -->
  8. <el-row>
  9. <el-col :span="6"
  10. ><dv-decoration-8
  11. class="title_right"
  12. :color="['#008CFF', '#00ADDD']"
  13. /></el-col>
  14. <el-col :span="12"
  15. ><div class="title_text">数 据 可 视 化 系 统</div>
  16. <dv-decoration-5
  17. class="title_center"
  18. :color="['#008CFF', '#00ADDD']"
  19. /></el-col>
  20. <el-col :span="6"
  21. ><div class="title_time">{{ dateYear + dateWeek + dateDay }}</div>
  22. <dv-decoration-8
  23. :reverse="true"
  24. class="title_left"
  25. :color="['#008CFF', '#00ADDD']"
  26. /></el-col>
  27. </el-row>
  28. <!-- 主体部分 -->
  29. <el-row>
  30. <!-- 第一列 -->
  31. <el-col :span="6">
  32. <!-- 饼图部分 -->
  33. <div class="left_box1">
  34. <dv-border-box-12>
  35. <div id="Rose_diagram"></div>
  36. <dv-active-ring-chart
  37. :config="config"
  38. class="left_box1_rose_right"
  39. />
  40. <div
  41. class="rose_text"
  42. v-for="(item, index) in numberData"
  43. :key="index"
  44. >
  45. <p>
  46. <span class="coin">¥</span>
  47. <span class="rose_text_nmb">{{
  48. item.number.number
  49. }}</span>
  50. </p>
  51. <p>
  52. <span>{{ item.text }}</span>
  53. <span class="colorYellow">(件)</span>
  54. </p>
  55. </div>
  56. </dv-border-box-12>
  57. </div>
  58. <!-- 柱状图部分 -->
  59. <div class="left_box2">
  60. <dv-border-box-12 style="padding-top: 10px">
  61. <p style="margin-left: 15px">数据统计图</p>
  62. <div id="columnar"></div>
  63. </dv-border-box-12>
  64. </div>
  65. <!-- 轮播表格部分 -->
  66. <div class="left_box3">
  67. <dv-border-box-12 style="padding-top: 10px">
  68. <dv-scroll-board
  69. :config="board_info"
  70. class="carousel_list"
  71. oddRowBGC="#fff"
  72. />
  73. </dv-border-box-12>
  74. </div>
  75. </el-col>
  76. <!-- 第二列 -->
  77. <el-col :span="12">
  78. <!-- 中国地图 -->
  79. <div id="china-map"></div>
  80. <!-- 折线图 -->
  81. <div class="line_center">
  82. <dv-border-box-8>
  83. <div id="line_center_diagram"></div>
  84. </dv-border-box-8>
  85. </div>
  86. </el-col>
  87. <!-- 第三列 -->
  88. <el-col :span="6">
  89. <!-- 轮播排行榜部分 -->
  90. <div class="right_box1">
  91. <dv-border-box-12>
  92. <dv-decoration-7 style="width: 100%; height: 30px"
  93. >销 售 排 行 榜</dv-decoration-7
  94. >
  95. <dv-scroll-ranking-board
  96. :config="config"
  97. style="width: 95%; height: 87%; margin-left: 2%"
  98. />
  99. </dv-border-box-12>
  100. </div>
  101. <!-- 虚线柱状图部分 -->
  102. <div class="right_box2">
  103. <dv-border-box-12 :reverse="true">
  104. <div id="dotter_bar"></div>
  105. </dv-border-box-12>
  106. </div>
  107. <!-- 部分 -->
  108. <div class="right_box3">
  109. <dv-border-box-12 :reverse="true">
  110. <dv-conical-column-chart :config="cone" class="cone_box" />
  111. </dv-border-box-12>
  112. </div>
  113. </el-col>
  114. </el-row>
  115. </div>
  116. </div>
  117. </div>
  118. </template>
  119. <script>
  120. import drawMixin from './drawMixin'; //自适应缩放
  121. import { formatTime } from './format.js'; //日期格式转换
  122. import * as echarts from 'echarts';
  123. export default {
  124. mixins: [drawMixin],
  125. components: {
  126. },
  127. data() {
  128. return {
  129. //定时器
  130. timing: null,
  131. //loading图
  132. loading: true,
  133. //时分秒
  134. dateDay: null,
  135. //年月日
  136. dateYear: null,
  137. //周几
  138. dateWeek: null,
  139. //周几
  140. weekday: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
  141. //轮播排行榜
  142. config: {
  143. data: [
  144. {
  145. name: '周口',
  146. value: 55,
  147. },
  148. {
  149. name: '南阳',
  150. value: 120,
  151. },
  152. {
  153. name: '西峡',
  154. value: 78,
  155. },
  156. {
  157. name: '驻马店',
  158. value: 66,
  159. },
  160. {
  161. name: '新乡',
  162. value: 80,
  163. },
  164. {
  165. name: '信阳',
  166. value: 45,
  167. },
  168. {
  169. name: '漯河',
  170. value: 29,
  171. },
  172. ],
  173. },
  174. //左侧饼图文字
  175. numberData: [
  176. {
  177. number: {
  178. number: 15,
  179. },
  180. text: '今日构建总量',
  181. },
  182. {
  183. number: {
  184. number: 1144,
  185. },
  186. text: '总共完成数量',
  187. },
  188. {
  189. number: {
  190. number: 361,
  191. },
  192. text: '正在编译数量',
  193. },
  194. ],
  195. //左侧轮播表格配置项
  196. board_info: {
  197. header: ['人员', '月产量', '月合格率'],
  198. data: [
  199. ['张三', '10830', '90%'],
  200. ['张四', '13500', '92%'],
  201. ['张五', '10350', '97%'],
  202. ['张六', '13300', '94%'],
  203. ['张七', '12500', '95%'],
  204. ['张八', '11500', '96%'],
  205. ['张九', '12500', '89%'],
  206. ['王六', '10360', '95%'],
  207. ['王二', '10567', '91%'],
  208. ['李四', '15721', '99%'],
  209. ],
  210. evenRowBGC: '#020308',
  211. oddRowBGC: '#382B47',
  212. headerBGC: '#020308',
  213. },
  214. // 定义颜色
  215. colorList: {
  216. linearYtoG: {
  217. type: 'linear',
  218. x: 0,
  219. y: 0,
  220. x2: 1,
  221. y2: 1,
  222. colorStops: [
  223. {
  224. offset: 0,
  225. color: '#f5b44d',
  226. },
  227. {
  228. offset: 1,
  229. color: '#28f8de',
  230. },
  231. ],
  232. },
  233. linearGtoB: {
  234. type: 'linear',
  235. x: 0,
  236. y: 0,
  237. x2: 1,
  238. y2: 0,
  239. colorStops: [
  240. {
  241. offset: 0,
  242. color: '#43dfa2',
  243. },
  244. {
  245. offset: 1,
  246. color: '#28f8de',
  247. },
  248. ],
  249. },
  250. linearBtoG: {
  251. type: 'linear',
  252. x: 0,
  253. y: 0,
  254. x2: 1,
  255. y2: 0,
  256. colorStops: [
  257. {
  258. offset: 0,
  259. color: '#1c98e8',
  260. },
  261. {
  262. offset: 1,
  263. color: '#28f8de',
  264. },
  265. ],
  266. },
  267. areaBtoG: {
  268. type: 'linear',
  269. x: 0,
  270. y: 0,
  271. x2: 0,
  272. y2: 1,
  273. colorStops: [
  274. {
  275. offset: 0,
  276. color: 'rgba(35,184,210,.2)',
  277. },
  278. {
  279. offset: 1,
  280. color: 'rgba(35,184,210,0)',
  281. },
  282. ],
  283. },
  284. },
  285. //锥形柱状图
  286. cone: {
  287. data: [
  288. {
  289. name: '周口',
  290. value: 55,
  291. },
  292. {
  293. name: '南阳',
  294. value: 120,
  295. },
  296. {
  297. name: '西峡',
  298. value: 71,
  299. },
  300. {
  301. name: '驻马店',
  302. value: 66,
  303. },
  304. {
  305. name: '新乡',
  306. value: 80,
  307. },
  308. {
  309. name: '信阳',
  310. value: 35,
  311. },
  312. {
  313. name: '漯河',
  314. value: 15,
  315. },
  316. ],
  317. showValue: true,
  318. },
  319. }
  320. },
  321. mounted() {
  322. //获取实时时间
  323. this.timeFn();
  324. //加载loading图
  325. this.cancelLoading();
  326. //中国地图
  327. this.china_map();
  328. //左侧玫瑰饼图
  329. this.Rose_diagram();
  330. //左侧柱状图
  331. this.columnar();
  332. //中间折线图
  333. this.line_center_diagram();
  334. //虚线柱状图
  335. this.dotter_bar();
  336. },
  337. beforeDestroy() {
  338. //离开时删除计时器
  339. clearInterval(this.timing);
  340. },
  341. methods: {
  342. //右上角当前日期时间显示:每一秒更新一次最新时间
  343. timeFn() {
  344. this.timing = setInterval(() => {
  345. //获取当前时分秒
  346. this.dateDay = formatTime(new Date(), 'HH: mm: ss');
  347. //获取当前年月日
  348. this.dateYear = formatTime(new Date(), 'yyyy-MM-dd');
  349. //获取当前周几
  350. this.dateWeek = this.weekday[new Date().getDay()];
  351. }, 1000);
  352. },
  353. //loading图
  354. cancelLoading() {
  355. setTimeout(() => {
  356. this.loading = false;
  357. }, 500);
  358. },
  359. //中国地图
  360. china_map() {
  361. let mapChart = this.$echarts.init(document.getElementById('china-map')); //图表初始化,china-map是绑定的元素
  362. window.onresize = mapChart.resize; //如果容器变大小,自适应从新构图
  363. let series = []; //存放循环配置项
  364. let res = []; //存放射线的起始点和结束点位置
  365. let province = []; //存放有射线的省的名字,以此来拿到对应省份的坐标
  366. //提前存好的所有省份坐标,用于后面根据名字拿到对应的左边
  367. let chinaGeoCoordMap = {
  368. 新疆: [86.9023, 41.148],
  369. 西藏: [87.8695, 31.6846],
  370. 内蒙古: [110.5977, 41.3408],
  371. 青海: [95.2402, 35.4199],
  372. 四川: [102.9199, 30.1904],
  373. 黑龙江: [128.1445, 46.7156],
  374. 甘肃: [102.7129, 38.166],
  375. 云南: [101.0652, 24.6807],
  376. 广西: [108.7813, 23.6426],
  377. 湖南: [111.5332, 27.3779],
  378. 陕西: [108.5996, 33.7396],
  379. 广东: [113.8668, 22.8076],
  380. 吉林: [126.1746, 43.5938],
  381. 河北: [115.4004, 38.1688],
  382. 湖北: [112.2363, 30.8572],
  383. 贵州: [106.6113, 26.6385],
  384. 山东: [118.2402, 36.2307],
  385. 江西: [115.7156, 27.99],
  386. 河南: [113.0668, 33.8818],
  387. 辽宁: [123.0438, 41.0889],
  388. 山西: [112.4121, 36.6611],
  389. 安徽: [117.2461, 31.0361],
  390. 福建: [118.3008, 25.9277],
  391. 浙江: [120.498, 29.0918],
  392. 江苏: [119.8586, 32.915],
  393. 重庆: [107.7539, 29.8904],
  394. 宁夏: [105.9961, 37.1096],
  395. 海南: [109.9512, 19.2041],
  396. 台湾: [120.8254, 23.5986],
  397. 北京: [116.4551, 40.2539],
  398. 天津: [117.4219, 39.4189],
  399. 上海: [121.4648, 31.2891],
  400. 香港: [114.6178, 22.3242],
  401. 澳门: [113.5547, 21.6484],
  402. };
  403. //后台给的数据模拟
  404. let lineData = [
  405. {
  406. val: 32, //数据
  407. blat: [86.9023, 41.148], //发射点
  408. elon: [87.8695, 31.6846], //接收点
  409. bcitysim: '新疆', //发射省的名字
  410. ecitysim: '西藏', //接收省的名字
  411. },
  412. {
  413. val: 31,
  414. blat: [87.8695, 31.6846],
  415. elon: [95.2402, 35.4199],
  416. bcitysim: '西藏',
  417. ecitysim: '青海',
  418. },
  419. {
  420. val: 33,
  421. blat: [86.9023, 41.148],
  422. elon: [95.2402, 35.4199],
  423. bcitysim: '新疆',
  424. ecitysim: '青海',
  425. },
  426. {
  427. val: 33,
  428. blat: [116.4551, 40.2539],
  429. elon: [119.8586, 32.915],
  430. bcitysim: '北京',
  431. ecitysim: '江苏',
  432. },
  433. {
  434. val: 33,
  435. blat: [120.8254, 23.5986],
  436. elon: [109.9512, 19.2041],
  437. bcitysim: '台湾',
  438. ecitysim: '海南',
  439. },
  440. {
  441. val: 33,
  442. blat: [120.498, 29.0918],
  443. elon: [115.7156, 27.99],
  444. bcitysim: '浙江',
  445. ecitysim: '江西',
  446. },
  447. {
  448. val: 33,
  449. blat: [117.2461, 31.0361],
  450. elon: [119.8586, 32.915],
  451. bcitysim: '安徽',
  452. ecitysim: '江苏',
  453. },
  454. {
  455. val: 33,
  456. blat: [117.2461, 31.0361],
  457. elon: [105.9961, 37.1096],
  458. bcitysim: '安徽',
  459. ecitysim: '宁夏',
  460. },
  461. {
  462. val: 33,
  463. blat: [117.2461, 31.0361],
  464. elon: [107.7539, 29.8904],
  465. bcitysim: '安徽',
  466. ecitysim: '重庆',
  467. },
  468. {
  469. val: 33,
  470. blat: [117.2461, 31.0361],
  471. elon: [123.0438, 41.0889],
  472. bcitysim: '安徽',
  473. ecitysim: '辽宁',
  474. },
  475. {
  476. val: 33,
  477. blat: [119.8586, 32.915],
  478. elon: [102.7129, 38.166],
  479. bcitysim: '江苏',
  480. ecitysim: '甘肃',
  481. },
  482. {
  483. val: 33,
  484. blat: [119.8586, 32.915],
  485. elon: [128.1445, 46.7156],
  486. bcitysim: '江苏',
  487. ecitysim: '黑龙江',
  488. },
  489. {
  490. val: 33,
  491. blat: [119.8586, 32.915],
  492. elon: [110.5977, 41.3408],
  493. bcitysim: '江苏',
  494. ecitysim: '内蒙古',
  495. },
  496. {
  497. val: 33,
  498. blat: [119.8586, 32.915],
  499. elon: [101.0652, 24.6807],
  500. bcitysim: '江苏',
  501. ecitysim: '云南',
  502. },
  503. {
  504. val: 33,
  505. blat: [119.8586, 32.915],
  506. elon: [86.9023, 41.148],
  507. bcitysim: '江苏',
  508. ecitysim: '新疆',
  509. },
  510. {
  511. val: 33,
  512. blat: [86.9023, 41.148],
  513. elon: [110.5977, 41.3408],
  514. bcitysim: '新疆',
  515. ecitysim: '内蒙古',
  516. },
  517. {
  518. val: 33,
  519. blat: [86.9023, 41.148],
  520. elon: [102.9199, 30.1904],
  521. bcitysim: '新疆',
  522. ecitysim: '四川',
  523. },
  524. ];
  525. //循环拿到处理好的数据
  526. for (var i = 0; i < lineData.length; i++) {
  527. province.push(lineData[i].bcitysim); //存进去每个省的名字
  528. province.push(lineData[i].ecitysim); //存进去每个省的名字
  529. res.push({
  530. fromName: lineData[i].bcitysim, //发射的省名,保存用于弹框显示
  531. toName: lineData[i].ecitysim, //接收的省名,保存用于弹框显示
  532. coords: [
  533. lineData[i].blat, //发射
  534. lineData[i].elon, //接收
  535. ],
  536. count: lineData[i].val, //数据
  537. });
  538. }
  539. let index_data = new Set(province); //把省的名字去重
  540. let data_res = []; //定义一个新的变量存放省的坐标
  541. //注意这里一定要用name和value的形式。不是这个格式的散点图显示不出来
  542. index_data.forEach((item) => {
  543. data_res.push({
  544. name: item, //每个省的名字
  545. value: chinaGeoCoordMap[item], //每个省的坐标
  546. });
  547. });
  548. //循环往series内添加配置项
  549. series.push(
  550. {
  551. //射线效果图层
  552. type: 'lines', //类型:射线
  553. zlevel: 1, //类似图层效果
  554. effect: {
  555. show: true, //是否显示图标
  556. symbol: 'arrow', //箭头图标
  557. symbolSize: 5, //图标大小
  558. trailLength: 0.02, //特效尾迹长度[0,1]值越大,尾迹越长重
  559. },
  560. label: {
  561. show: true,
  562. },
  563. lineStyle: {
  564. color: '#fff',
  565. normal: {
  566. color: '#00A0FF',
  567. width: 1, //尾迹线条宽度
  568. opacity: 0.5, //尾迹线条透明度
  569. curveness: 0.1, //尾迹线条曲直度
  570. },
  571. },
  572. //提示框信息
  573. tooltip: {
  574. formatter: function (param) {
  575. return (
  576. param.data.fromName +
  577. '>' +
  578. param.data.toName +
  579. '<br>数量:' +
  580. param.data.count
  581. );
  582. },
  583. },
  584. data: res, //拿到射线的起始点和结束点
  585. },
  586. //散点图
  587. // {
  588. // type: "effectScatter",//散点图
  589. // coordinateSystem: "geo",//这个不能删,删了不显示
  590. // zlevel: 1,
  591. // rippleEffect: {
  592. // //涟漪特效
  593. // period: 4, //动画时间,值越小速度越快
  594. // brushType: "stroke", //波纹绘制方式 stroke, fill
  595. // scale: 4, //波纹圆环最大限制,值越大波纹越大
  596. // },
  597. // //设置文字部分
  598. // label: {
  599. // normal: {
  600. // show: true, //省份名显示隐藏
  601. // position: "right", //省份名显示位置
  602. // offset: [5, 0], //省份名偏移设置
  603. // formatter: function (params) {
  604. // //圆环显示省份名
  605. // return params.name; //这个名字是根据data中的name来显示的
  606. // },
  607. // fontSize: 12,//文字大小
  608. // },
  609. // emphasis: {
  610. // show: true,
  611. // },
  612. // },
  613. // symbol: "circle",//散点图
  614. // symbolSize: 5,//散点大小
  615. // itemStyle: {//散点样式
  616. // normal: {
  617. // show: true,
  618. // color: "#fff",
  619. // },
  620. // },
  621. // data: data_res, //处理好后的散点图坐标数组
  622. // },
  623. //点击高亮
  624. {
  625. type: 'map',
  626. mapType: 'china',
  627. zlevel: 1,
  628. roam: true,
  629. geoIndex: 0,
  630. tooltip: {
  631. show: true,
  632. },
  633. itemStyle: {
  634. areaColor: '#00196d',
  635. borderColor: '#0a53e9',
  636. },
  637. emphasis: {
  638. show: true,
  639. label: {
  640. normal: {
  641. show: true, // 是否显示对应地名
  642. textStyle: {
  643. color: '#fff',
  644. },
  645. },
  646. },
  647. itemStyle: {
  648. areaColor: '#00196d',
  649. borderColor: '#0a53e9',
  650. },
  651. },
  652. }
  653. );
  654. //配置
  655. let option = {
  656. //title可要可不要
  657. // title: {
  658. // text: "查查的地图",
  659. // textStyle: {
  660. // color: "#ffffff",
  661. // },
  662. // },
  663. legend: {
  664. show: true,
  665. selected: {},
  666. x: 'left',
  667. orient: 'vertical',
  668. textStyle: {
  669. color: 'white',
  670. },
  671. data: [],
  672. },
  673. //鼠标移上去的弹框
  674. tooltip: {
  675. trigger: 'item',
  676. show: true,
  677. },
  678. //geo:这是重点
  679. geo: {
  680. map: 'china', //中国地图
  681. zoom: 1.2, //缩放倍数
  682. roam: false, //是否允许缩放和拖拽地图
  683. label: {
  684. normal: {
  685. show: true, // 是否显示省份名字,现在是隐藏的状态,因为和散点图的名字重叠了。如果需要就true
  686. textStyle: {
  687. //名字的样式
  688. color: '#fff',
  689. },
  690. },
  691. emphasis: {
  692. show: true,
  693. },
  694. },
  695. //地图样式
  696. itemStyle: {
  697. normal: {
  698. borderColor: '#293171', //地图边框颜色
  699. borderWidth: '2', //地图边框粗细
  700. areaColor: '#0A0F33', //地图背景色
  701. },
  702. //省份地图阴影
  703. emphasis: {
  704. areaColor: null,
  705. shadowOffsetX: 0,
  706. shadowOffsetY: 0,
  707. shadowBlur: 20,
  708. borderWidth: 0,
  709. shadowColor: '#fff',
  710. },
  711. },
  712. },
  713. series: series, //图表配置
  714. };
  715. mapChart.setOption(option); //生成图表
  716. },
  717. //玫瑰饼图
  718. Rose_diagram() {
  719. let mapChart = this.$echarts.init(
  720. document.getElementById('Rose_diagram')
  721. ); //图表初始化,china-map是绑定的元素
  722. window.onresize = mapChart.resize; //如果容器变大小,自适应从新构图
  723. let option = {
  724. color: [
  725. '#37a2da',
  726. '#32c5e9',
  727. '#9fe6b8',
  728. '#ffdb5c',
  729. '#ff9f7f',
  730. '#fb7293',
  731. '#e7bcf3',
  732. '#8378ea',
  733. ],
  734. tooltip: {
  735. trigger: 'item',
  736. formatter: '{a} <br/>{b} : {c} ({d}%)',
  737. },
  738. toolbox: {
  739. show: true,
  740. },
  741. calculable: true,
  742. legend: {
  743. orient: 'horizontal',
  744. icon: 'circle',
  745. bottom: 0,
  746. x: 'center',
  747. data: ['data1', 'data2', 'data3', 'data4', 'data5', 'data6'],
  748. textStyle: {
  749. color: '#fff',
  750. },
  751. },
  752. series: [
  753. {
  754. name: '通过率统计',
  755. type: 'pie',
  756. radius: [10, 50],
  757. roseType: 'area',
  758. center: ['50%', '40%'],
  759. data: [
  760. { value: 10, name: 'data1' },
  761. { value: 5, name: 'data2' },
  762. { value: 15, name: 'data3' },
  763. { value: 25, name: 'data4' },
  764. { value: 20, name: 'data5' },
  765. { value: 35, name: 'data6' },
  766. ],
  767. },
  768. ],
  769. };
  770. mapChart.setOption(option); //生成图表
  771. },
  772. //柱状图
  773. columnar() {
  774. let mapChart = this.$echarts.init(document.getElementById('columnar')); //图表初始化,china-map是绑定的元素
  775. window.onresize = mapChart.resize; //如果容器变大小,自适应从新构图
  776. let option = {
  777. title: {
  778. text: '',
  779. },
  780. tooltip: {
  781. trigger: 'axis',
  782. backgroundColor: 'rgba(255,255,255,0.1)',
  783. axisPointer: {
  784. type: 'shadow',
  785. label: {
  786. show: true,
  787. backgroundColor: '#7B7DDC',
  788. },
  789. },
  790. },
  791. legend: {
  792. data: ['已贯通', '计划贯通', '贯通率'],
  793. textStyle: {
  794. color: '#B4B4B4',
  795. },
  796. top: '0%',
  797. },
  798. grid: {
  799. x: '8%',
  800. width: '95%',
  801. y: '4%',
  802. },
  803. xAxis: {
  804. data: [
  805. '市区',
  806. '万州',
  807. '江北',
  808. '南岸',
  809. '北碚',
  810. '綦南',
  811. '长寿',
  812. '永川',
  813. '璧山',
  814. '江津',
  815. '城口',
  816. '大足',
  817. '垫江',
  818. '丰都',
  819. '奉节',
  820. '合川',
  821. '江津区',
  822. '开州',
  823. '南川',
  824. '彭水',
  825. '黔江',
  826. '石柱',
  827. '铜梁',
  828. '潼南',
  829. '巫山',
  830. '巫溪',
  831. '武隆',
  832. '秀山',
  833. '酉阳',
  834. '云阳',
  835. '忠县',
  836. '川东',
  837. '检修',
  838. ],
  839. axisLine: {
  840. lineStyle: {
  841. color: '#B4B4B4',
  842. },
  843. },
  844. axisTick: {
  845. show: false,
  846. },
  847. },
  848. yAxis: [
  849. {
  850. splitLine: { show: false },
  851. axisLine: {
  852. lineStyle: {
  853. color: '#B4B4B4',
  854. },
  855. },
  856. axisLabel: {
  857. formatter: '{value} ',
  858. },
  859. },
  860. ],
  861. series: [
  862. {
  863. name: '已贯通',
  864. type: 'bar',
  865. barWidth: 10,
  866. itemStyle: {
  867. normal: {
  868. barBorderRadius: 5,
  869. color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
  870. { offset: 0, color: '#956FD4' },
  871. { offset: 1, color: '#3EACE5' },
  872. ]),
  873. },
  874. },
  875. data: [
  876. 46, 50, 55, 650, 75, 85, 99, 125, 140, 215, 232, 244, 252, 333,
  877. 46, 50, 55, 65, 75, 85, 99, 225, 140, 215, 85, 99, 125, 140, 215,
  878. 232, 244, 252, 75,
  879. ],
  880. },
  881. {
  882. name: '计划贯通',
  883. type: 'bar',
  884. barGap: '-100%',
  885. barWidth: 10,
  886. itemStyle: {
  887. normal: {
  888. barBorderRadius: 5,
  889. color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
  890. { offset: 0, color: 'rgba(156,107,211,0.8)' },
  891. { offset: 0.2, color: 'rgba(156,107,211,0.5)' },
  892. { offset: 1, color: 'rgba(156,107,211,0.2)' },
  893. ]),
  894. },
  895. },
  896. z: -12,
  897. data: [
  898. 180, 207, 240, 283, 328, 360, 398, 447, 484, 504, 560, 626, 595,
  899. 675, 180, 207, 240, 283, 328, 360, 398, 447, 484, 504, 360, 398,
  900. 447, 484, 504, 500, 326, 495, 328,
  901. ],
  902. },
  903. ],
  904. };
  905. mapChart.setOption(option); //生成图表
  906. },
  907. //折线图
  908. line_center_diagram() {
  909. let mapChart = this.$echarts.init(
  910. document.getElementById('line_center_diagram')
  911. ); //图表初始化,china-map是绑定的元素
  912. window.onresize = mapChart.resize; //如果容器变大小,自适应从新构图
  913. let option = {
  914. xAxis: {
  915. type: 'category',
  916. data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
  917. position: 'bottom',
  918. axisLine: true,
  919. axisLabel: {
  920. color: 'rgba(255,255,255,.8)',
  921. fontSize: 12,
  922. },
  923. },
  924. yAxis: {
  925. type: 'value',
  926. name: '年度生产量',
  927. nameLocation: 'end',
  928. nameGap: 24,
  929. nameTextStyle: {
  930. color: 'rgba(255,255,255,.5)',
  931. fontSize: 14,
  932. },
  933. splitNumber: 4,
  934. axisLine: {
  935. lineStyle: {
  936. opacity: 0,
  937. },
  938. },
  939. splitLine: {
  940. show: true,
  941. lineStyle: {
  942. color: '#fff',
  943. opacity: 0.1,
  944. },
  945. },
  946. axisLabel: {
  947. color: 'rgba(255,255,255,.8)',
  948. fontSize: 12,
  949. },
  950. },
  951. grid: {
  952. left: 50,
  953. right: 10,
  954. bottom: 25,
  955. top: '18%',
  956. },
  957. series: [
  958. {
  959. data: [820, 932, 901, 934, 1290, 1330, 1320],
  960. type: 'line',
  961. smooth: true,
  962. symbol: 'emptyCircle',
  963. symbolSize: 8,
  964. itemStyle: {
  965. normal: {
  966. color: '#fff',
  967. },
  968. },
  969. //线的颜色样式
  970. lineStyle: {
  971. normal: {
  972. color: this.colorList.linearBtoG,
  973. width: 3,
  974. },
  975. },
  976. //填充颜色样式
  977. areaStyle: {
  978. normal: {
  979. color: this.colorList.areaBtoG,
  980. },
  981. },
  982. },
  983. ],
  984. };
  985. mapChart.setOption(option); //生成图表
  986. },
  987. //右侧虚线柱状图图
  988. dotter_bar() {
  989. let mapChart = this.$echarts.init(document.getElementById('dotter_bar')); //图表初始化,china-map是绑定的元素
  990. window.onresize = mapChart.resize; //如果容器变大小,自适应从新构图
  991. // Generate data
  992. let category = [];
  993. let dottedBase = +new Date();
  994. let lineData = [];
  995. let barData = [];
  996. for (let i = 0; i < 20; i++) {
  997. let date = new Date((dottedBase += 3600 * 24 * 1000));
  998. category.push(
  999. [date.getFullYear(), date.getMonth() + 1, date.getDate()].join('-')
  1000. );
  1001. let b = Math.random() * 200;
  1002. let d = Math.random() * 200;
  1003. barData.push(b);
  1004. lineData.push(d + b);
  1005. }
  1006. // option
  1007. let option = {
  1008. tooltip: {
  1009. trigger: 'axis',
  1010. axisPointer: {
  1011. type: 'shadow',
  1012. },
  1013. },
  1014. grid: {
  1015. left: 50,
  1016. right: 10,
  1017. bottom: 25,
  1018. top: '18%',
  1019. },
  1020. legend: {
  1021. data: ['line', 'bar'],
  1022. textStyle: {
  1023. color: '#ccc',
  1024. },
  1025. },
  1026. xAxis: {
  1027. data: category,
  1028. axisLine: {
  1029. lineStyle: {
  1030. color: '#ccc',
  1031. },
  1032. },
  1033. },
  1034. yAxis: {
  1035. splitLine: { show: false },
  1036. axisLine: {
  1037. lineStyle: {
  1038. color: '#ccc',
  1039. },
  1040. },
  1041. },
  1042. series: [
  1043. {
  1044. name: 'line',
  1045. type: 'line',
  1046. smooth: true,
  1047. showAllSymbol: true,
  1048. symbol: 'emptyCircle',
  1049. symbolSize: 15,
  1050. data: lineData,
  1051. },
  1052. {
  1053. name: 'bar',
  1054. type: 'bar',
  1055. barWidth: 10,
  1056. itemStyle: {
  1057. borderRadius: 5,
  1058. // color: "#14c8d4",
  1059. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  1060. { offset: 0, color: '#14c8d4' },
  1061. { offset: 1, color: '#43eec6' },
  1062. ]),
  1063. },
  1064. data: barData,
  1065. },
  1066. {
  1067. name: 'line',
  1068. type: 'bar',
  1069. barGap: '-100%',
  1070. barWidth: 10,
  1071. itemStyle: {
  1072. // color: "rgba(20,200,212,0.5)",
  1073. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  1074. { offset: 0, color: 'rgba(20,200,212,0.5)' },
  1075. { offset: 0.2, color: 'rgba(20,200,212,0.2)' },
  1076. { offset: 1, color: 'rgba(20,200,212,0)' },
  1077. ]),
  1078. },
  1079. z: -12,
  1080. data: lineData,
  1081. },
  1082. {
  1083. name: 'dotted',
  1084. type: 'pictorialBar',
  1085. symbol: 'rect',
  1086. itemStyle: {
  1087. color: '#0f375f',
  1088. },
  1089. symbolRepeat: true,
  1090. symbolSize: [12, 4],
  1091. symbolMargin: 1,
  1092. z: -10,
  1093. data: lineData,
  1094. },
  1095. ],
  1096. };
  1097. mapChart.setOption(option); //生成图表
  1098. },
  1099. },
  1100. }
  1101. </script>
  1102. <style lang="scss" scoped>
  1103. * {
  1104. margin: 0;
  1105. padding: 0;
  1106. list-style-type: none;
  1107. outline: none;
  1108. box-sizing: border-box;
  1109. }
  1110. html {
  1111. margin: 0;
  1112. padding: 0;
  1113. }
  1114. body {
  1115. font-family: Arial, Helvetica, sans-serif;
  1116. line-height: 1.2em;
  1117. background-color: #f1f1f1;
  1118. margin: 0;
  1119. padding: 0;
  1120. }
  1121. a {
  1122. color: #343440;
  1123. text-decoration: none;
  1124. }
  1125. //页面样式部分!!!!
  1126. #index {
  1127. color: #d3d6dd;
  1128. // width: 100%;
  1129. // height: calc(100% - 60px);
  1130. width: 1920px;
  1131. height: 1080px;
  1132. position: absolute;
  1133. top: 50%;
  1134. left: 50%;
  1135. transform: translate(-50%, -50%);
  1136. transform-origin: left top;
  1137. overflow: hidden;
  1138. background: #2a2a2a;
  1139. .bg {
  1140. //整体页面背景
  1141. width: 100%;
  1142. height: 100%;
  1143. padding: 16px 16px 0 16px;
  1144. // background-image: url("../assets/pageBg.png"); //背景图
  1145. background-size: cover; //背景尺寸
  1146. background-position: center center; //背景位置
  1147. }
  1148. //顶部右边装饰效果
  1149. .title_left {
  1150. width: 100%;
  1151. height: 50px;
  1152. }
  1153. //顶部左边装饰效果
  1154. .title_right {
  1155. width: 100%;
  1156. height: 50px;
  1157. margin-top: 18px;
  1158. }
  1159. //顶部中间装饰效果
  1160. .title_center {
  1161. width: 100%;
  1162. height: 50px;
  1163. }
  1164. //顶部中间文字数据可视化系统
  1165. .title_text {
  1166. text-align: center;
  1167. font-size: 24px;
  1168. font-weight: bold;
  1169. margin-top: 14px;
  1170. color: #008cff;
  1171. }
  1172. //时间日期
  1173. .title_time {
  1174. text-align: center;
  1175. }
  1176. //中国地图
  1177. #china-map {
  1178. height: 660px;
  1179. width: 100%;
  1180. }
  1181. //中间折线图
  1182. .line_center {
  1183. width: 100%;
  1184. height: 288px;
  1185. }
  1186. //左1模块
  1187. .left_box1 {
  1188. height: 310px;
  1189. width: 100%;
  1190. margin-bottom: 10px;
  1191. position: relative;
  1192. }
  1193. //左2模块
  1194. .left_box2 {
  1195. height: 310px;
  1196. width: 100%;
  1197. margin-bottom: 10px;
  1198. }
  1199. //左3模块
  1200. .left_box3 {
  1201. height: 310px;
  1202. width: 100%;
  1203. }
  1204. //右1模块
  1205. .right_box1 {
  1206. height: 310px;
  1207. width: 100%;
  1208. margin-bottom: 10px;
  1209. }
  1210. //右2模块
  1211. .right_box2 {
  1212. height: 310px;
  1213. width: 100%;
  1214. margin-bottom: 10px;
  1215. }
  1216. //右3模块
  1217. .right_box3 {
  1218. height: 310px;
  1219. width: 100%;
  1220. }
  1221. //左1模块-玫瑰饼图
  1222. #Rose_diagram {
  1223. height: 70%;
  1224. width: 55%;
  1225. }
  1226. //左1模块-圆环图
  1227. .left_box1_rose_right {
  1228. height: 85%;
  1229. width: 55%;
  1230. position: absolute;
  1231. right: 0;
  1232. top: 0;
  1233. }
  1234. //左1模块-文字部分
  1235. .rose_text {
  1236. display: inline-block;
  1237. margin-top: 4%;
  1238. margin-left: 4%;
  1239. }
  1240. // 左1模块-¥符号样式
  1241. .coin {
  1242. font-size: 20px;
  1243. color: #ffc107;
  1244. }
  1245. //左1模块-(件)样式
  1246. .colorYellow {
  1247. color: yellowgreen;
  1248. }
  1249. //左1模块-数字样式
  1250. .rose_text_nmb {
  1251. font-size: 20px;
  1252. color: #00b891;
  1253. }
  1254. //左2模块 柱状图
  1255. #columnar {
  1256. height: 97%;
  1257. width: 95%;
  1258. margin-left: 3%;
  1259. margin-top: 5px;
  1260. }
  1261. //折线图
  1262. #line_center_diagram {
  1263. height: 100%;
  1264. width: 100%;
  1265. }
  1266. //轮播表格
  1267. .carousel_list {
  1268. width: 96%;
  1269. height: 98%;
  1270. margin-left: 10px;
  1271. }
  1272. //虚线柱状图
  1273. #dotter_bar {
  1274. width: 100%;
  1275. height: 100%;
  1276. }
  1277. //锥形图
  1278. .cone_box {
  1279. width: 95%;
  1280. height: 97%;
  1281. margin-left: 3%;
  1282. }
  1283. }
  1284. </style>