bottomRightChart1.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <div>
  3. <div id="bottomRightChart1" style="width:100%;height:2.5rem;">
  4. <div class="bg-color-black">
  5. </div>
  6. </div>
  7. </div>
  8. </template>
  9. <script>
  10. import echartMixins from "@/utils/resizeMixins";
  11. export default {
  12. data() {
  13. return {
  14. chart:null
  15. };
  16. },
  17. mixins: [echartMixins],
  18. mounted() {
  19. this.draw();
  20. },
  21. methods: {
  22. draw() {
  23. // 基于准备好的dom,初始化echarts实例
  24. this.chart = this.echarts.init(document.getElementById('bottomRightChart1'))
  25. let Option={
  26. color: ['#00DDFF', '#37A2FF'],
  27. tooltip: {
  28. trigger: 'axis',
  29. type: 'category',
  30. },
  31. /* 标识 */
  32. legend: {
  33. data: ['实际', '计划'],
  34. textStyle:{
  35. color: '#ffffff'//字体颜色
  36. }
  37. },
  38. /* 周围边距 */
  39. grid: {
  40. left: '3%',
  41. right: '3%',
  42. bottom: '1%',
  43. top: '13%',
  44. containLabel: true
  45. },
  46. xAxis: [
  47. {
  48. type: 'category',
  49. boundaryGap: false,
  50. 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'],
  51. axisLabel: {//x轴文字的配置
  52. show: true,
  53. textStyle: {
  54. color: '#ffffff',
  55. }
  56. },
  57. }
  58. ],
  59. yAxis: [
  60. {
  61. type: 'value',
  62. axisLabel: {
  63. textStyle: {
  64. fontSize: 10,
  65. color: '#ffffffff',
  66. margin: 15
  67. },
  68. }
  69. }
  70. ],
  71. series: [
  72. {
  73. name: this.$t('实际'),
  74. type: 'line',
  75. symbol: "none",
  76. data: [20, 32, 1, 34, 90, 30, 20, 20, 32, 1, 34, 90, 40, 10, 20, 82, 11, 34, 20, 30, 10, 20, 82, 11, 34, 20, 40, 10]
  77. },
  78. {
  79. name: this.$t('计划'),
  80. type: 'line',
  81. symbol: "none",
  82. data: [20, 82, 11, 24, 20, 30, 10, 20, 82, 11, 24, 20, 10, 20, 20, 32, 21, 34, 10, 30, 20, 20, 32, 21, 34, 19, 13, 20]
  83. },
  84. ]
  85. };
  86. this.chart.setOption(Option);
  87. }
  88. },
  89. destroyed() {
  90. window.onresize = null;
  91. }
  92. };
  93. </script>
  94. <style lang="scss" scoped>
  95. #bottomRight1 {
  96. padding: 0.2rem 0.2rem 0;
  97. height: 6.5rem;
  98. min-width: 3.75rem;
  99. border-radius: 0.0625rem;
  100. .bg-color-black {
  101. height: 6.1875rem;
  102. border-radius: 0.125rem;
  103. }
  104. .text {
  105. color: #c3cbde;
  106. } //下滑线动态
  107. .decoration2 {
  108. position: absolute;
  109. right: 0.125rem;
  110. }
  111. .chart-box {
  112. margin-top: 0.2rem;
  113. width: 2.125rem;
  114. height: 2.125rem;
  115. .active-ring-name {
  116. padding-top: 0.125rem;
  117. }
  118. }
  119. .naturalGasData {
  120. display: flex;
  121. justify-content: space-between;
  122. float: right;
  123. position: relative;
  124. }
  125. }
  126. </style>