湖里大屏(数字工地):新增AI分析 echart 图配置

This commit is contained in:
Jack 2022-08-13 15:40:36 +08:00
parent c62c5d1afc
commit 9df3b6f36a

View File

@ -3,7 +3,7 @@
<!-- <JNestedRingChart :title="{ text: 652, subTitle: '本周总任务' }" :series="series" /> -->
<div class="air">
<div class="pieAnalyse2" ref="pieAnalyse" style="width: 100%; height: 60%"></div>
<div class="pieAnalyse" ref="pieAnalyse"></div>
<img class="image" src="~@/assets/images/longguang/cutimage/AI_empty.png" v-if="!aiWarning.total" />
</div>
</Card>
@ -13,6 +13,7 @@
import { getAITypeStatistics } from '@/assets/js/api/companyBigScreen.js'
import Card from '../components/Card.vue'
import JNestedRingChart from '../jChart/pie/JNestedRingChart.vue'
import echarts from 'echarts4'
export default {
components: { Card, JNestedRingChart },
props: {
@ -60,21 +61,15 @@ export default {
this.$set(this.aiWarning, 'total', totalAlarmNum)
this.$set(this.aiWarning, 'list', alarmList)
this.pieAnalyse()
}
})
},
// AI
pieAnalyse() {
console.log(this.$refs.pieAnalyse)
let pieAnalyse = echarts.init(this.$refs.pieAnalyse, 'dark')
let total = this.totalDangerAlarmType
let dataArray = this.dangerAlarmTypeList.map(x => {
return {
value: x.alarmNum,
name: x.alarmTypeName
}
})
console.log(dataArray)
let dataArray = this.aiWarning.list.map(x => ({ value: x.alarmNum, name: x.alarmTypeName }))
pieAnalyse.setOption({
color: ['#49B6A0', '#C16C28', '#F4A968', '#4378D8', '#D94916', '#9FD6F4', '#24A79A', '#786FF0'],
animation: false,
@ -102,7 +97,6 @@ export default {
backgroundColor: 'rgba(3,6,9,0)',
series: [
{
// name: '',
type: 'pie',
center: ['25%', '50%'],
radius: ['70%', '95%'],
@ -111,7 +105,7 @@ export default {
show: true,
position: 'center',
color: 'white',
formatter: '{total|' + total + '}' + '\n\n' + '{active|预警总数}',
formatter: '{total|' + this.aiWarning.total + '}' + '\n\n' + '{active|预警总数}',
rich: {
total: {
fontSize: 17
@ -139,10 +133,9 @@ export default {
position: relative;
width: 100%;
height: 100%;
.pieAnalyse2 {
position: absolute;
top: 20%;
left: 4%;
.pieAnalyse {
width: 100%;
height: 100%;
}
.image {
position: absolute;