tengsx
2023-04-06 80eb2e8d0eb78caf0b5d369aba18f99ed1222b97
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
 
<template>
  <div class="echarts-box" id="rainLineChart">
  
  </div>
</template>
 
<script>
export default {
  data() {
      return {
        myChart: null
      }
  },
  
  mounted() {
    let stackBarData = {
        xAxisData: ["4-1", "4-2", "4-3", "4-4", "4-5", "4-6", "4-7", "4-8"],
        seriesData: [820, 932, 901, 934, 1290, 1330, 1320,1320,1320],
      }
      this.$nextTick(() => {
          this.createAreaLine(stackBarData)
      })
  },
  destroyed() {
 
  },
  methods: {
    createAreaLine(chartData) {
      this.myChart = this.$echarts.init(
          document.getElementById('rainLineChart')
        );
      let option =  {
        xAxis: {
          show: true,
          type: 'category',
          axisLine: {
            show: true,
            lineStyle: {
              widht: 2,
              color: '#EA7629'
            }
          },
          axisTick: {
            show: false
          },
          axisLabel: {
            show: false
          },
          data: chartData.xAxisData
        },
        yAxis: {
          show: false,
          type: 'value'
        },
        grid: {
          left: 0,
          right: 0,
          top: 0,
          bottom: 2,
        },
        series: [
          {
            data: chartData.seriesData,
            type: 'line',
            symbol: 'none',
            lineStyle: {
              widht: 2,
              color: '#EA7629'
            },
            areaStyle: {
              color: 'rgba(234,118,41,0.5)'
            }
          }
        ]
      };
      this.myChart.setOption(option)
    }
      
  },
}
</script>
 
<style lang="scss" scoped>
.echarts-box {
  width: 100%;
  height: 100%;
}
</style>