dataDetails.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <el-dialog width="50%" @closed="closed()" :show-close="false" class="my-info-dialog">
  3. <template #title>
  4. <div class="showTitles">
  5. <div class="titles">{{title}}详情</div>
  6. </div>
  7. </template>
  8. <div class="body">
  9. <div id="detailEcharts" class="echarts"></div>
  10. </div>
  11. </el-dialog>
  12. </template>
  13. <script>
  14. import * as echarts from "echarts";
  15. export default {
  16. props: {
  17. title: {
  18. type: String,
  19. default: '111',
  20. required: true,
  21. },
  22. },
  23. updated() {
  24. this.getEcharts()
  25. },
  26. mounted() {
  27. },
  28. data(){
  29. return{
  30. xdata: []
  31. }
  32. },
  33. methods: {
  34. getEcharts() {
  35. let chartDom = document.getElementById('detailEcharts');
  36. let myChart = echarts.init(chartDom, '#ffffff');
  37. let option;
  38. option = {
  39. legend: {
  40. show: true,
  41. data: ["111", "222"],
  42. right: 56,
  43. icon: "circle",
  44. itemWidth: 6,
  45. inactiveColor: '#606769',
  46. textStyle: {
  47. color: '#B3BDC0',
  48. fontSize: 12,
  49. },
  50. },
  51. // title: {
  52. // text: 'Income of Germany and France since 1950'
  53. // },
  54. tooltip: {
  55. trigger: 'axis'
  56. },
  57. xAxis: [
  58. {
  59. type: "category",
  60. boundaryGap: false,
  61. axisLabel: {
  62. interval: 60,
  63. showMinLabel: true,
  64. showMaxLabel: true,
  65. formatter: "{value}",
  66. fontSize: 14,
  67. textStyle: {
  68. color: '#606769',
  69. },
  70. },
  71. axisLine: {
  72. show: false,
  73. },
  74. data: this.xdata,
  75. },
  76. ],
  77. yAxis: {
  78. type: "value",
  79. // name: 'y轴',
  80. axisLabel: {
  81. formatter: "{value}",
  82. fontSize: 14,
  83. },
  84. axisLine: {
  85. show: false,
  86. },
  87. splitLine: {
  88. show: true,
  89. lineStyle: {
  90. color: '#606769',
  91. type: "dashed",
  92. },
  93. },
  94. },
  95. series: [{
  96. name: '111',
  97. smooth: true,
  98. showSymbol: false,
  99. data: [150, 230, 224, 218, 135, 147, 260, 150, 230, 224, 218, 135, 147, 260, 150, 230, 224, 218, 135, 147, 260, 150, 230, 224, 218, 135, 147, 260, 150, 230, 224, 218, 135, 147, 260,],
  100. type: 'line'
  101. },
  102. {
  103. name: '222',
  104. smooth: true,
  105. showSymbol: false,
  106. data: [50, 30, 24, 18, 35, 47, 60, 50, 30, 24, 18, 35, 47, 60, 50, 30, 24, 18, 35, 47, 60, 50, 30, 24, 18, 35, 47, 60, 50, 30, 24, 18, 35, 47, 60,],
  107. type: 'line'
  108. }]
  109. };
  110. option && myChart.setOption(option);
  111. },
  112. closed() {
  113. this.$emit('closed');
  114. },
  115. },
  116. }
  117. </script>
  118. <style>
  119. .showTitles {
  120. display: flex;
  121. flex-direction: row;
  122. align-items: center;
  123. justify-content: center;
  124. margin-top: -10px;
  125. font-size: 18px;
  126. color: #FFFFFF;
  127. }
  128. .body {
  129. background-color: black;
  130. width: 100%;
  131. margin-top: -30px;
  132. /* height: 200px; */
  133. }
  134. .echarts {
  135. width: 900px;
  136. height: 480px;
  137. /* margin-top: 20px; */
  138. margin-left: 10px;
  139. padding-top: 20px;
  140. }
  141. </style>