北京经济技术开发区经开区虚拟城市项目-【前端】-移动端Web
少年
2024-02-27 c6df06bd690486739067ee1ee7124ac66da720fb
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<template>
    <div class="videoPanel">
        <div class="menutop">
            <div class="menuback" @click="back">
                <i class="el-icon-arrow-left"></i><span>统计</span>
            </div>
            <div class="menutitle">摄像头</div>
        </div>
        <div style="margin-top: 0.2rem" class="videoContainer">
            <div id="videoBar"></div>
        </div>
    </div>
</template>
 
<script>
import * as echarts from 'echarts';
import store from "@/utils/store.js";
export default {
    name: 'ManholePanel',
    data() {
        return {
            videoData: [3500, 1725, 2947, 8000, 1700, 1200, 2500, 1401, 2100, 1324]
        }
    },
    mounted() {
        this.getBar();
    },
    methods: {
        getBar() {
            let that = this;
            let barChartDom = document.getElementById('videoBar');
            let myBarChart = echarts.init(barChartDom);
            let option = {
                color: ["#FFD700"],
                grid: {
                    x: 40,
                    y: 40,
                    x2: 80
                },
                xAxis: {
                    type: 'category',
                    data: ['荣华街道', '博兴街道', '亦庄镇', '旧宫镇', '瀛海镇', '台湖镇', '马驹桥镇', '青云店镇', '长子营镇', '采育镇'],
                    axisLabel: {
                        interval: 0,
                        rotate: 45,
                        color: "#000"
                    },
                    axisTick: {
                        show: false//不显示坐标轴刻度线
                    },
                    axisLine: {
                        show: true,//不显示坐标轴线
                        lineStyle: {
                            color: "#b7c8eb"
                        }
                    },
                    name: '(行政区划)',
                    nameLocation: 'end',
                    nameTextStyle: {
                        fontSize: 14,
                        color: '#000'
                        // padding: [32, 0, 0, 0]
                    }
                },
                yAxis: {
                    type: 'value',
                    name: '(摄像头数量)',
                    //nameRotate: '90',
                    nameLocation: 'end',
                    nameTextStyle: {
                        fontSize: 14,
                        padding: [0, 0, 0, -10]
                    },
                    axisTick: {
                        show: false//不显示坐标轴刻度线
                    },
                    axisLine: {
                        show: false,//不显示坐标轴线
                    },
                    splitLine: {     //网格线
                        "show": false
                    }
                },
                series: [
                    {
                        data: that.videoData,
                        type: 'bar',
                        barWidth: 6,
                        // barGap:'90%'
                        itemStyle: {  // 使用方法二的写法
                            color: {
                                type: 'linear',
                                x: 0,  //右
                                y: 0,  //下
                                x2: 0,  //左
                                y2: 1,  //上
                                colorStops: [
                                    {
                                        offset: 0,
                                        color: '#9FC3F3 ' // 0% 处的颜色
                                    },
                                    // {
                                    //     offset: 0.7,
                                    //     color: '#2378f7' // 70% 处的颜色
                                    // },
                                    {
                                        offset: 1,
                                        color: '#3460BC ' // 100% 处的颜色
                                    }
                                ]
                            }
                        },
                    }
                ]
            };
            option && myBarChart.setOption(option);
        },
        back() {
            store.setVideoStatisticsShow(false);
        }
    },
}
</script>
 
<style scoped>
.videoPanel {
    position: absolute;
    color: black;
    width: 100%;
    height: 100%;
    background-color: white;
    z-index: 4001;
}
 
#videoBar {
    width: 375px;
    height: 320px;
}
.videoContainer{
    padding: 0.1rem 0.1rem; 
}
</style>