EBottom2.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <div class="container">
  3. <div id="EBottom2" style="height:100%;"></div>
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. name: "EBottom2",
  9. data() {
  10. return {
  11. data: [40, 38.5, 48.2, 43.6, 42.8, 55.6, 44.6],
  12. };
  13. },
  14. mounted() {
  15. this.drawChart();
  16. },
  17. methods: {
  18. drawChart() {
  19. // 基于准备好的dom,初始化echarts实例
  20. let myChart = this.$echarts.init(
  21. document.getElementById("EBottom2")
  22. );
  23. // 指定图表的配置项和数据
  24. let option = {
  25. // backgroundColor: "#0D1943",
  26. title: {
  27. left: "4%",
  28. top: "4%",
  29. text: "屠宰率",
  30. textStyle: {
  31. color: "#fff",
  32. fontSize: 30,
  33. },
  34. },
  35. tooltip: {
  36. trigger: "axis",
  37. textStyle: {
  38. fontSize: 25,
  39. color: "#fff"
  40. }
  41. },
  42. grid: {
  43. x: "5%",
  44. y: "18%",
  45. x2: "8%",
  46. y2: "5%",
  47. containLabel: true,
  48. },
  49. toolbox: {
  50. feature: {
  51. saveAsImage: {},
  52. },
  53. },
  54. xAxis: {
  55. type: "category",
  56. boundaryGap: false,
  57. name: "(时间)",
  58. nameTextStyle: {
  59. fontSize: 20,
  60. },
  61. axisLine: {
  62. show: true,
  63. lineStyle: {
  64. type: "solid",
  65. color: "#fff", //左边线的颜色
  66. width: "2", //坐标线的宽度
  67. },
  68. },
  69. axisLabel: {
  70. textStyle: {
  71. color: "#fff",
  72. fontSize: 20,
  73. },
  74. },
  75. data: [
  76. "08-01",
  77. "08-02",
  78. "08-03",
  79. "08-04",
  80. "08-05",
  81. "08-06",
  82. "08-07",
  83. ],
  84. },
  85. yAxis: [
  86. {
  87. type: "value",
  88. nameTextStyle: {
  89. fontSize: 20,
  90. },
  91. axisLine: {
  92. show: true,
  93. lineStyle: {
  94. type: "solid",
  95. color: "#fff", //左边线的颜色
  96. width: "2", //坐标线的宽度
  97. },
  98. },
  99. axisLabel: {
  100. formatter: "{value} %",
  101. textStyle: {
  102. color: "#fff",
  103. fontSize: 20,
  104. },
  105. },
  106. },
  107. ],
  108. series: [
  109. {
  110. name: "屠宰率",
  111. type: "line",
  112. lineStyle: {
  113. color: "#01d7ef",
  114. width: 2,
  115. },
  116. areaStyle: {
  117. //区域填充样式
  118. normal: {
  119. //线性渐变
  120. color: new this.$echarts.graphic.LinearGradient(
  121. 0,
  122. 0,
  123. 0,
  124. 1,
  125. [
  126. {
  127. offset: 0,
  128. color: "#01d7ef", // 0% 处的颜色
  129. },
  130. {
  131. offset: 1,
  132. color: "#0d1943", // 100% 处的颜色
  133. },
  134. ],
  135. false
  136. ),
  137. },
  138. },
  139. itemStyle: {
  140. //borderWidth: 3,
  141. //borderColor: 'yellow',
  142. color: "#01d7ef",
  143. },
  144. symbol: "circle",
  145. symbolSize: 15, //折线点的大小
  146. data: [33, 43.4, 46, 41, 42, 38, 46],
  147. },
  148. ],
  149. };
  150. // 使用刚指定的配置项和数据显示图表。
  151. myChart.setOption(option);
  152. },
  153. },
  154. };
  155. </script>
  156. <style lang="scss" scoped>
  157. </style>