centerRight2.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <div id="centreRight2">
  3. <div class="bg-color-black">
  4. <div class="d-flex pt-2 pl-2">
  5. <span style="color:#5cd9e8">
  6. <icon name="align-left"></icon>
  7. </span>
  8. <span class="fs-xl text mx-2">峰谷电量</span>
  9. </div>
  10. <div class="d-flex jc-center body-box" style=" margin-top: 0;">
  11. <div id="peakToValley" style="width:100%;height:2.5rem;"></div>
  12. </div>
  13. <div class="d-flex jc-center body-box" style=" margin-top: 0;height: 60px">
  14. <div class="fontElec"><p class="title-p">发电量</p><p class="title-p2">{{dashboardelecdata.ypg}}</p></div>
  15. </div>
  16. <div class="d-flex jc-center body-box" style=" margin-top: 0;height: 60px">
  17. <div class="fontElec"><p class="title-p">倒电量</p> <p class="title-p2">{{dashboardelecdata.daodianliang}}</p></div>
  18. </div>
  19. <div class="d-flex jc-center body-box" style=" margin-top: 0;height: 60px">
  20. <div class="fontElec"><p class="title-p">用电量</p><p class="title-p2">{{dashboardelecdata.eveLec}}</p>p</div>
  21. </div>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import centreRight2Chart1 from "@/components/echart/centreRight2/centreRight2Chart1";
  27. export default {
  28. props: ['dashboardelecdata'],
  29. data() {
  30. return {
  31. config: {
  32. data: [
  33. {
  34. name: "A",
  35. value: 167
  36. },
  37. {
  38. name: "B",
  39. value: 67
  40. },
  41. {
  42. name: "C",
  43. value: 123
  44. },
  45. {
  46. name: "D",
  47. value: 55
  48. },
  49. ],
  50. showValue: true
  51. }
  52. };
  53. },
  54. components: { centreRight2Chart1 },
  55. mounted() {
  56. this.initChart();
  57. },
  58. methods: {
  59. initChart() {
  60. // 基于准备好的dom,初始化echarts实例
  61. this.chart = this.echarts.init(document.getElementById('peakToValley'))
  62. this.chart.setOption({
  63. /* 周围边距 */
  64. grid: {
  65. left: '3%',
  66. right: '3%',
  67. bottom: '1%',
  68. top: '20%',
  69. containLabel: true
  70. },
  71. tooltip: {
  72. trigger: 'axis',
  73. axisPointer: {
  74. type: 'shadow'
  75. }
  76. },
  77. xAxis: [
  78. {
  79. type: 'category',
  80. data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'],
  81. axisTick: {
  82. alignWithLabel: true
  83. }
  84. }
  85. ],
  86. yAxis: [
  87. {
  88. type: 'value'
  89. }
  90. ],
  91. series: [
  92. {
  93. name: 'Direct',
  94. type: 'bar',
  95. barWidth: '60%',
  96. markPoint: {
  97. data: [
  98. { type: 'max', name: 'Max' },
  99. { type: 'min', name: 'Min' }
  100. ]
  101. },
  102. data: [10, 52, 20, 33, 30, 30, -34, 10, 33, 20, 33, 30, 30, -13, 10, 12, 20, 33, 30, 30, -20, 10, 43, 20, 33, 30, 30, -20, 12, 45, -11]
  103. }
  104. ]
  105. })
  106. },
  107. }
  108. };
  109. </script>
  110. <style lang="scss">
  111. #centreRight2 {
  112. padding: 0.0625rem;
  113. height: 5rem;
  114. min-width: 3.75rem;
  115. border-radius: 0.0625rem;
  116. .bg-color-black {
  117. padding: 0.0625rem;
  118. height: 5.2rem;
  119. border-radius: 0.125rem;
  120. }
  121. .text {
  122. color: #c3cbde;
  123. }
  124. .body-box {
  125. border-radius: 0.125rem;
  126. overflow: hidden;
  127. }
  128. }
  129. .title-p{
  130. font-size: 16px;
  131. float: left;
  132. }
  133. .title-p2{
  134. margin-left: 0.3rem;
  135. width:100px;
  136. color: #cfe5ea;
  137. font:30px/15px 'ds-digitalbold';
  138. float: left;
  139. }
  140. .fontElec {
  141. //width:100px;
  142. //margin-left: 0.3rem;
  143. //padding-top: 0.25rem;
  144. //color: #cfe5ea;
  145. //font:30px/15px 'ds-digitalbold';
  146. //text-align:center;
  147. }
  148. </style>