analysisChartBottomLeft1.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <div>
  3. <div id="analysisChartBottomLeft1" style="width:3.4rem;height:2.2rem;"></div>
  4. </div>
  5. </template>
  6. <script>
  7. import echartMixins from "@/utils/resizeMixins";
  8. export default {
  9. data() {
  10. return {
  11. chart: null
  12. }
  13. },
  14. mixins: [echartMixins],
  15. mounted() {
  16. this.init();
  17. },
  18. methods: {
  19. init() {
  20. this.chart = this.echarts.init(document.getElementById("analysisChartBottomLeft1"), 'dark');
  21. let option = {
  22. backgroundColor: 'transparent',
  23. title: {
  24. text: ''
  25. },
  26. tooltip: {
  27. trigger: 'axis',
  28. axisPointer: {
  29. type: 'shadow'
  30. }
  31. },
  32. legend: {},
  33. grid: {
  34. left: '3%',
  35. right: '4%',
  36. bottom: '3%',
  37. containLabel: true
  38. },
  39. yAxis: {
  40. type: 'value',
  41. boundaryGap: [0, 0.01],
  42. axisLabel: {
  43. color: '#808080'
  44. },
  45. splitLine: {
  46. show: true,
  47. lineStyle:{
  48. color: 'rgba(255,255,255,.7)'
  49. }
  50. }
  51. },
  52. xAxis: {
  53. type: 'category',
  54. data: ['Waste Water', 'Rain Water',],
  55. axisLabel: {
  56. color: '#808080'
  57. },
  58. },
  59. series: [
  60. {
  61. name: '实时 PH',
  62. type: 'bar',
  63. data: [6,9],
  64. itemStyle: {
  65. normal: {
  66. color: new this.echarts.graphic.LinearGradient(0, 0, 0, 1, [
  67. { offset: 0, color: "rgba(255, 189, 91, 0.8)" },
  68. { offset: 1, color: "rgba(255, 189, 91, 0.3)" }
  69. ])
  70. }
  71. },
  72. label: {
  73. show: true,
  74. position: 'top',
  75. textStyle: {
  76. fontSize: 25,
  77. fontWeight: 'bold',
  78. color: '#fff'
  79. }
  80. }
  81. },
  82. {
  83. name: '7 天平均 PH',
  84. type: 'bar',
  85. data: [11, 7],
  86. color: '#A8CBFF',
  87. itemStyle: {
  88. normal: {
  89. color: new this.echarts.graphic.LinearGradient(0, 0, 0, 1, [
  90. { offset: 0, color: "rgba(100, 100, 100, 0.8)" },
  91. { offset: 1, color: "rgba(100, 100, 100, 0.3)" }
  92. ])
  93. }
  94. }
  95. },
  96. ]
  97. };
  98. this.chart.setOption(option);
  99. }
  100. },
  101. destroyed() {
  102. window.onresize = null;
  103. }
  104. }
  105. </script>
  106. <style>
  107. </style>