zhgdyun/src/views/projectAdmin/fourEngin/components/environmentWatchTwo.vue

329 lines
8.6 KiB
Vue
Raw Normal View History

<template>
<!-- <div class="monBox" > -->
<div id="box111"></div>
<!-- <div class="colour flex5" v-show="this.$props.show">
<div class="colour_content">
<div
class="bg"
style="
background: #20b5db;
border-top-left-radius: 8px;
border-bottom-left-radius: 8px;
"
></div>
<div class="size">{{ $t("message.projectSummary.actor") }}</div>
</div>
<div class="colour_content">
<div class="bg" style="background: #35ca83"></div>
<div class="size">{{ $t("message.projectSummary.fine") }}</div>
</div>
<div class="colour_content">
<div class="bg" style="background: #e3ce6d"></div>
<div class="size">{{ $t("message.projectSummary.mildContamination") }}</div>
</div>
<div class="colour_content">
<div class="bg" style="background: #ef93c5"></div>
<div class="size">{{ $t("message.projectSummary.middleLevelPollution") }}</div>
</div>
<div class="colour_content">
<div class="bg" style="background: #ff348a"></div>
<div class="size">{{ $t("message.projectSummary.actheavyPollutionor") }}</div>
</div>
<div class="colour_content">
<div
class="bg"
style="
background: #f64643;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
"
></div>
<div class="size">{{ $t("message.projectSummary.severeContamination") }}</div>
</div>
</div> -->
<!-- </div> -->
</template>
<script>
import echarts from 'echarts4'
import { getCurrentDayAirQualityApi } from '@/assets/js/api/environmentManage'
export default {
props: ['show'], // 控制空气质量条是否显示
data() {
return {
option: null,
chart: Object,
lineColor: '#1FCCC6',
todayAir: {
analysisData: '0',
analysisType: '优'
}
}
},
mounted() {
this.createdEcharts3()
},
methods: {
createdEcharts3() {
var chartDom = document.getElementById('box111');
var myChart = echarts.init(chartDom);
var option;
// 数据进度值
// 数据进度值
var dataArr = 80;
var option = {
// backgroundColor: "#FFFFFF",
title: {
show: true,
text: '优',
x: '48.5%',
y: '54%',
z: 8,
textAlign: 'center',
textStyle: {
color: '#458efd',
fontSize: 20,
fontWeight: 'normal'
},
},
series: [{
name: "内部(环形)进度条",
type: "gauge",
// center: ['30%', '40%'],
radius: '50%',
splitNumber: 20,
axisLine: {
lineStyle: {
color: [
[dataArr / 80, '#6acdc9'],
[1]
],
width: 5
}
},
axisLabel: {
show: false,
},
axisTick: {
show: false,
},
splitLine: {
show: false,
},
pointer: {
show: false,
},
},
{
name: '外部刻度',
type: 'gauge',
// center: ['20%', '50%'],
radius: '62%',
min: 0, //最小刻度
max: 100, //最大刻度
splitNumber: 10, //刻度数量
startAngle: 225,
endAngle: -45,
axisLine: {
show: true,
// 仪表盘刻度线
lineStyle: {
width: 1,
color: [
[1]
]
}
},
//仪表盘文字
axisLabel: {
show: true,
color: '#7abec4',
distance: 8,
fontSize:8,
formatter: function(v) {
switch (v + '') {
case '0':
return '0';
case '10':
return '10';
case '20':
return '20';
case '30':
return '30';
case '40':
return '40';
case '50':
return '50';
case '60':
return '60';
case '70':
return '70';
case '80':
return '80';
case '90':
return '90';
case '100':
return '100';
}
}
}, //刻度标签。
axisTick: {
show: true,
splitNumber: 8,
lineStyle: {
color: '#7abec4', //用颜色渐变函数不起作用
width: 1,
},
length: -5
}, //刻度样式
splitLine: {
show: true,
length: -8,
lineStyle: {
color: '#7abec4', //用颜色渐变函数不起作用
width: 1,
}
}, //分隔线样式
detail: {
show: false
},
pointer: {
show: false
}
},
/*内部*/
{
type: 'pie',
radius: ['37%', '33%'],
center: ['50%', '50%'],
z: 8,
hoverAnimation: false,
data: [{
name: '检查进度',
value: dataArr,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(122, 190, 196,1)'
}, {
offset: 1,
color: 'rgba(122, 190, 196,1)'
}])
}
},
label: {
normal: {
formatter: function(params) {
return params.value ;
},
color: '#458efd',
fontSize: 30,
fontWeight: "bold",
position: 'center',
show: true
}
},
labelLine: {
show: false
}
}],
},
/*外一层*/
{
type: "pie",
radius: ['39%', '35%'],
startAngle: 220,
endAngle: -40,
hoverAnimation: false,
center: ["50%", "50%"],
avoidLabelOverlap: false,
label: {
show: false
},
labelLine: {
show: false
},
data: [{
value: 1,
itemStyle: {
normal: {
color: 'rgba(122, 190, 196,.6)'
}
}
}],
},
//外二层圈
{
type: "pie",
radius: ['41%', '38%'],
center: ["50%", "50%"],
avoidLabelOverlap: false,
z: 0,
hoverAnimation: false,
label: {
show: false
},
labelLine: {
show: false
},
data: [{
"value": 1,
itemStyle: {
normal: {
color: 'rgba(122, 190, 196,.2)'
}
}
}]
}
]
};
option && myChart.setOption(option);
}
}
}
</script>
<style lang="less" scoped>
#box111{
width: 100%;
height: 100%;
}
// .colour {
// position: absolute;
// bottom: 0;
// margin-top: 20px;
// width: 100%;
// font-size: 10px;
// left: 2%;
// .colour_content {
// width: 16%;
// text-align: center;
// float: left;
// .bg {
// width: 100%;
// height: 8px;
// margin-bottom: 10px;
// }
// .size {
// width: 100%;
// white-space: nowrap;
// overflow: hidden;
// text-overflow: ellipsis;
// }
// }
// }
</style>