Blame view

src/components/weekAndDay/index.vue 3.76 KB
22fb20b3   songchongxian   城市停车运营监控
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
  <template>
    <div class="app-weekAndDayBox">
      <el-row :gutter="10" style="height:100%;">
        <el-col :span="12" class="aside-padding" style="height:100%;">
          <uWeek class="u-uWeek">W</uWeek>
        </el-col>
        <el-col :span="12" class="aside-padding" style="height:100%;">
          <uDay class="u-uDay">D</uDay>
        </el-col>
      </el-row>
    </div>
  </template>
  
  <script>
    import uDay from './uDay'
    import uWeek from './uWeek'
    import echarts from 'echarts'
      export default {
        name: "weekAndDay",
        components: {
          uDay,
          uWeek,
        },
        data() {
          return {
            legendArr: [],
            //color: this.$store.state.color,
            lineChart: {},
            name: '折线图'
          }
        },
        methods: {
          createLine(){
            // 基于准备好的dom,初始化echarts实例
            this.lineChart = echarts.init(document.querySelector('.lineChart'));
            const option={
              color: ['#325B69', '#698570', '#AE5548', '#6D9EA8', '#9CC2B0', '#C98769'],
              grid: {
                top: '5%',
                left: '2%',
                right: '5%',
                bottom: '8%',
                containLabel: true
              },
              title: {
                show: false
              },
              tooltip: {
                trigger: 'axis',
                show:false
              },
              legend: {
                show: false
              },
              toolbox: {
                show: false
              },
              xAxis: [{
                name: '产品',
                type: 'category',
                axisLine: {
                  show: false
                },
                axisTick: {
                  show: false
                },
                nameTextStyle: {
                  color: 'rgba(255, 255, 255, 0.69)'
                },
                axisLabel: {
                  textStyle: {
                    color: 'white'
                  }
                },
                data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
              }],
              yAxis: [{
                axisLine: {
                  show: false
                },
                nameLocation: 'end',
                nameGap: 20,
                nameRotate: 0,
                axisTick: {
                  show: false
                },
                splitLine: {
                  lineStyle: {
                    color: ['rgba(230, 230, 230, 0.2)']
                  }
                },
                axisLabel: {
                  textStyle: {
                    color: 'white',
                    fontSize: 14
                  }
                },
                name: '数量',
                type: 'value',
                nameTextStyle: {
                  color: 'rgba(255, 255, 255, 0.69)'
                }
              }],
              series: [{
                name: '标签3',
                type: 'line',
                stack: '总量',
                data: [50, 32, 21, 14, 20, 30, 40]
              }, {
                name: '标签4',
                type: 'line',
                stack: '总量',
                data: [30, 32, 31, 34, 30, 30, 20]
              }, {
                name: '标签5',
                type: 'line',
                stack: '总量',
                data: [20, 32, 1, 34, 20, 13, 10]
              }]
            };
            this.lineChart.setOption(option);
            window.addEventListener('resize', function() {
              this.lineChart.resize();
              console.log("resize");
            }.bind(this));
          }
22fb20b3   songchongxian   城市停车运营监控
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
        }
      }
  </script>
  
  <style scoped  lang="scss">
    .app-weekAndDayBox {
      width: 100%;
      .theme-card{
        height: 100%;
      }
      .lineChart{
        position: absolute;
        margin: 0 auto;
        top:0;
        bottom: 0;
        left:0;
        width: 100%;
        height: 100%;
      }
      .u-uWeek,.u-uDay{
        height: 100%;
  
      }
    }
  </style>