新增了饼图内圈转动的效果

This commit is contained in:
严妍 2022-09-07 17:24:22 +08:00
parent 2966eaefb0
commit 93d73a1e93
6 changed files with 97 additions and 49 deletions

View File

@ -28,13 +28,17 @@ export default {
series: [
{
roseType: 'area',
startAngle:90,
radius: ['58%', '54%'],
color: ['#0B1B35', '#244D8F'],
data: [30, 40, 30, 40]
data: [30, 40, 30, 40],
hoverAnimation:false,
},
{
color: ['#3CABFC', '#FF6C7F', '#6EE4F0', '#557EED'],
data
startAngle:90,
data,
hoverAnimation:false,
}
]
}

View File

@ -32,6 +32,16 @@ export default {
mounted() {
this.jNestedRingChart = echarts.init(this.$refs.jNestedRingChart)
this.createChart()
this.$nextTick(() => {
this.drawChart();
this.timer = setInterval(() => {
this.doing();
}, 200);
});
},
destroyed(){
clearInterval(this.timer)
this.timer = ''
},
data() {
return {
@ -97,7 +107,17 @@ export default {
delete option.legend;
}
this.jNestedRingChart.setOption(option)
}
},
drawChart() {
this.myChart = echarts.init(this.$refs.jNestedRingChart);
this.option = {
series: this.series
};
},
doing() {//
this.series[0].startAngle = this.series[0].startAngle - 5;
this.myChart.setOption(this.option);
},
},
watch: {
series() {

View File

@ -19,21 +19,25 @@ export default {
data() {
return {
series: [
{
roseType: 'area',
startAngle:90,
radius: ['58%', '54%'],
color: ['#0B1B35', '#244D8F'],
data: [30, 40, 30, 40],
hoverAnimation:false,
},
{
color: ['#3cabfd', '#58ec72', '#f43a8d', '#f294c6', '#6ee4f0',],
startAngle:90,
data: [
{ value: 45, name: '文明施工' },
{ value: 5, name: '未分类' },
{ value: 15, name: '安全管理' },
{ value: 10, name: '施工安全' },
{ value: 45, name: '基础工程' },
]
},
{
roseType: 'area',
radius: ['58%', '54%'],
color: ['#0B1B35', '#244D8F'],
data: [30, 40, 30, 40]
],
hoverAnimation:false,
}
]
}

View File

@ -45,20 +45,24 @@ export default {
ybUrgentLevelNum: 10
},
series: [
{
color: ['#3aaaff', '#ff6982'],
center: ['50%', '50%'],
data: [
{ value: 50, name: '已整改质量问题' },
{ value: 15, name: '未整改质量问题' }
]
},
{
{
roseType: 'area',
startAngle:90,
center: ['50%', '50%'],
radius: ['58%', '54%'],
color: ['#0B1B35', '#244D8F'],
data: [30, 40, 30, 40]
data: [30, 40, 30, 40],
hoverAnimation:false,
},
{
color: ['#3aaaff', '#ff6982'],
center: ['50%', '50%'],
startAngle:90,
data: [
{ value: 50, name: '已整改质量问题' },
{ value: 15, name: '未整改质量问题' }
],
hoverAnimation:false,
}
]
}

View File

@ -29,7 +29,22 @@ export default {
ybUrgentLevelNum: '',
yzUrgentLevelNum: ''
},
series: []
series: [
{
roseType: 'area',
startAngle: 90,
radius: ['58%', '54%'],
color: ['#0B1B35', '#244D8F'],
data: [30, 40, 30, 40],
hoverAnimation:false,
},
{
color: ['#3DACFE', '#6DE4F0', '#FE6C7F'],
startAngle: 90,
data: [],
hoverAnimation:false,
}
]
}
},
created() {
@ -44,21 +59,10 @@ export default {
selectQualityStatisticsApi(data).then(res => {
const data = res.result || {}
this.total = data.total
this.series = [
{
color: ['#3DACFE', '#6DE4F0', '#FE6C7F'],
data: [
{ value: this.total.jyUrgentLevelNum, name: '紧要问题' },
{ value: this.total.yzUrgentLevelNum, name: '严重问题' },
{ value: this.total.ybUrgentLevelNum, name: '一般问题' }
]
},
{
roseType: 'area',
radius: ['58%', '54%'],
color: ['#0B1B35', '#244D8F'],
data: [30, 40, 30, 40]
}
this.series[1].data = [
{ value: this.total.jyUrgentLevelNum, name: '紧要问题' },
{ value: this.total.yzUrgentLevelNum, name: '严重问题' },
{ value: this.total.ybUrgentLevelNum, name: '一般问题' }
]
})
}
@ -74,18 +78,22 @@ export default {
.content {
height: calc(100% - 30px);
display: flex;
.chart {
width: 55%;
height: 100%;
}
.count {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.count-item {
position: relative;
&::before {
position: absolute;
left: -16px;
@ -95,20 +103,25 @@ export default {
height: 6px;
border-radius: 50%;
}
&:first-child {
margin-bottom: 20px;
}
&:first-child::before {
background-color: #557dee;
}
&:last-child::before {
background-color: #43d7b5;
}
.label {
margin-bottom: 8px;
font-size: 14px;
color: rgba(255, 255, 255, 0.7);
}
.num {
font-size: 18px;
}

View File

@ -36,29 +36,32 @@ export default {
mounted() {
selectSecurityManageStatisticsApi({ projectSn: this.projectSn }).then(res => {
const totals = res.result.total
this.series = [
{
color: ['#3DACFE', '#6DE4F0', '#FE6C7F'],
data: [
this.series[1].data = [
{ value: totals.weekInspectNum, name: '周检' },
{ value: totals.monthInspectNum, name: '月检' },
{ value: totals.otherInspectNum, name: '其他' }
]
},
{
roseType: 'area',
radius: ['58%', '54%'],
color: ['#0B1B35', '#244D8F'],
data: [30, 40, 30, 40]
}
]
this.totalNum = totals.totalNum
})
},
data() {
return {
projectSn: this.$store.state.projectSn,
series: [],
series: [
{
roseType: 'area',
startAngle:90,
radius: ['58%', '54%'],
color: ['#0B1B35', '#244D8F'],
data: [30, 40, 30, 40],
hoverAnimation:false,
},{
color: ['#3DACFE', '#6DE4F0', '#FE6C7F'],
startAngle:90,
data:[],
hoverAnimation:false,
}
],
total: 0
}
},