parking_period_analysis.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div class="body-wrapper">
  3. <h4 style="color: white">停车高峰时段分析</h4>
  4. <br>
  5. <div style="width: 100%; height: 400px">
  6. <linechart
  7. :autoStop="false"
  8. :top="30"
  9. :bottom="30"
  10. :left="40"
  11. :legendTop="0"
  12. yAxisName="(辆)"
  13. :dataset="linedata"
  14. :tooltipFormat="lineTooltipFormat"
  15. :encode="[
  16. { x: 'mouth', y: 'lastYearAmount', seriesName: '入场',bool:'true' },
  17. { x: 'mouth', y: 'thisYearAmount', seriesName: '出场',bool:'true' },
  18. ]"
  19. id="sxcyfzqk"
  20. />
  21. </div>
  22. <h4 style="color: white">出入场压力分析</h4>
  23. <br>
  24. <div style="width: 100%; height: 580px">
  25. <barchart
  26. class="side-chart"
  27. :autoStop="false"
  28. :colorArr="['#ffd201', '#00eacb', '#01b4ff', '#5d78ff']"
  29. legendIcon="react"
  30. :bottom="180"
  31. :xlabelFormat="xLabelFormat"
  32. :top="60"
  33. yAxisName="(辆)"
  34. :tooltip="tooltipFormat"
  35. :dataset="bardata1"
  36. :encode="[
  37. {x: 'month', y: 'hs', seriesName: '入场'},
  38. {x: 'month', y: 'cs', seriesName: '出场'}]"
  39. :labelSize="15"
  40. id="fxdqhszzt"
  41. />
  42. </div>
  43. <h4 style="color: white">停车饱和度分析</h4>
  44. <br/>
  45. <div style="width: 100%; height: 580px">
  46. <barchart
  47. class="side-chart"
  48. :autoStop="false"
  49. :colorArr="['#ffd201', '#00eacb', '#01b4ff', '#5d78ff']"
  50. legendIcon="react"
  51. :bottom="180"
  52. :xlabelFormat="xLabelFormat"
  53. :top="60"
  54. yAxisName="(辆)"
  55. :tooltip="tooltipFormat1"
  56. :dataset="bardata2"
  57. :encode="[
  58. {x: 'month', y: 'hs', seriesName: '占用'},
  59. {x: 'month', y: 'cs', seriesName: '空闲'}]"
  60. :labelSize="15"
  61. id="fxdqhszzt1"
  62. />
  63. </div>
  64. </div>
  65. </template>
  66. <script>
  67. import linechart from "@/components/lineChart";
  68. import barchart from "@/components/barChart";
  69. import api from '@/api/audit'
  70. export default {
  71. components: {
  72. linechart,
  73. barchart
  74. },
  75. data() {
  76. return {
  77. linedata: [],
  78. bardata1: [],
  79. bardata2: []
  80. }
  81. },
  82. mounted() {
  83. this.getLineData()
  84. this.getBarData1()
  85. this.getBarData2()
  86. },
  87. watch: {},
  88. methods: {
  89. getLineData() {
  90. api.tcsdfx1().then(res => {
  91. this.linedata = res.data || []
  92. })
  93. },
  94. getBarData1() {
  95. api.tcsdfx2().then(res => {
  96. this.bardata1 = res.data || []
  97. })
  98. },
  99. getBarData2() {
  100. api.tcsdfx2().then(res => {
  101. this.bardata2 = res.data || []
  102. })
  103. },
  104. lineTooltipFormat(params) {
  105. const data = params[0].data;
  106. return `<div class="line-tooltip">
  107. <div style="color: ${params[0].color}">${params[0].seriesName}: ${
  108. params[0].data.lastYearAmount || "--"
  109. }(辆)</div>
  110. <div style="color: ${params[1].color}">${params[1].seriesName}: ${
  111. params[0].data.thisYearAmount || "--"
  112. }(辆)</div>
  113. </div>`;
  114. },
  115. tooltipFormat(params) {
  116. const type = params[0].seriesType;
  117. const data = params[0].data;
  118. // ${params[0].name || "--"}月:
  119. return `<div class="line-tooltip">
  120. <div>${params[0].seriesName}: ${
  121. params[0].data.hs || "--"}辆</div>
  122. <div>${params[1].seriesName}: ${
  123. params[0].data.cs || "--"}辆</div>
  124. </div>`;
  125. },
  126. tooltipFormat1(params) {
  127. const type = params[0].seriesType;
  128. const data = params[0].data;
  129. // ${params[0].name || "--"}月:
  130. return `<div class="line-tooltip">
  131. <div>${params[0].seriesName}: ${
  132. params[0].data.hs || "--"}个</div>
  133. <div>${params[1].seriesName}: ${
  134. params[0].data.cs || "--"}个</div>
  135. </div>`;
  136. },
  137. xLabelFormat(name) {
  138. var str = name.split("");
  139. return str.join("\n");
  140. },
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .body-wrapper {
  146. padding: 20px;
  147. width: 100%;
  148. height: 100%;
  149. box-sizing: border-box;
  150. background: #0c0c0c;
  151. }
  152. </style>