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

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: [ series: [
{ {
roseType: 'area', roseType: 'area',
startAngle:90,
radius: ['58%', '54%'], radius: ['58%', '54%'],
color: ['#0B1B35', '#244D8F'], color: ['#0B1B35', '#244D8F'],
data: [30, 40, 30, 40] data: [30, 40, 30, 40],
hoverAnimation:false,
}, },
{ {
color: ['#3CABFC', '#FF6C7F', '#6EE4F0', '#557EED'], color: ['#3CABFC', '#FF6C7F', '#6EE4F0', '#557EED'],
data startAngle:90,
data,
hoverAnimation:false,
} }
] ]
} }

View File

@ -32,6 +32,16 @@ export default {
mounted() { mounted() {
this.jNestedRingChart = echarts.init(this.$refs.jNestedRingChart) this.jNestedRingChart = echarts.init(this.$refs.jNestedRingChart)
this.createChart() this.createChart()
this.$nextTick(() => {
this.drawChart();
this.timer = setInterval(() => {
this.doing();
}, 200);
});
},
destroyed(){
clearInterval(this.timer)
this.timer = ''
}, },
data() { data() {
return { return {
@ -97,7 +107,17 @@ export default {
delete option.legend; delete option.legend;
} }
this.jNestedRingChart.setOption(option) 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: { watch: {
series() { series() {

View File

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

View File

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

View File

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