EBottom1.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <div class="container">
  3. <div id="EBottom1" style="height: 100%"></div>
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. name: "EBottom1",
  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("EBottom1")
  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: ["5月", "6月", "7月", "8月", "9月", "10月", "11月"],
  76. },
  77. yAxis: [
  78. {
  79. type: "value",
  80. nameTextStyle: {
  81. fontSize: 20,
  82. },
  83. scale: true,
  84. min(val) {
  85. return Number((val.min * 0.9).toFixed(0));
  86. },
  87. axisLine: {
  88. show: true,
  89. lineStyle: {
  90. type: "solid",
  91. color: "#fff", //左边线的颜色
  92. width: "2", //坐标线的宽度
  93. },
  94. },
  95. axisLabel: {
  96. formatter: "{value} %",
  97. textStyle: {
  98. color: "#fff",
  99. fontSize: 20,
  100. },
  101. },
  102. },
  103. ],
  104. series: [
  105. {
  106. name: "产羔率",
  107. type: "line",
  108. lineStyle: {
  109. color: "#01d7ef",
  110. width: 2,
  111. },
  112. areaStyle: {
  113. //区域填充样式
  114. normal: {
  115. //线性渐变
  116. color: new this.$echarts.graphic.LinearGradient(
  117. 0,
  118. 0,
  119. 0,
  120. 1,
  121. [
  122. {
  123. offset: 0,
  124. color: "#01d7ef", // 0% 处的颜色
  125. },
  126. {
  127. offset: 1,
  128. color: "#0d1943", // 100% 处的颜色
  129. },
  130. ],
  131. false
  132. ),
  133. },
  134. },
  135. itemStyle: {
  136. //borderWidth: 3,
  137. //borderColor: 'yellow',
  138. color: "#01d7ef",
  139. },
  140. symbol: "circle",
  141. symbolSize: 15, //折线点的大小
  142. data: [252.6, 255.5, 252.4, 249.8, 252.6, 250.8, 251.9],
  143. },
  144. ],
  145. };
  146. // 使用刚指定的配置项和数据显示图表。
  147. myChart.setOption(option);
  148. },
  149. },
  150. };
  151. </script>
  152. <style lang="scss" scoped>
  153. </style>