You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
3.1 KiB

<template>
<div class="bottomLeft">
<dv-border-box-13>
<div class="chartsBox">
<div class="chartItem">
<p>手术等级</p>
<div class="echartsContainer" ref="echartsContainerLeft"></div>
</div>
<div class="chartItem">
<p>ASA分级</p>
<div class="echartsContainer" ref="echartsContainerRight"></div>
</div>
</div>
</dv-border-box-13>
</div>
</template>
<script>
import * as echarts from 'echarts';
export default {
data() {
return {
nowIndex: 0,
chartOptionsLeft: {
series: [
{
type: 'pie',
radius: ['32%', '50%'],
selectedMode: 'single',
data: [
{ name: '一级', value: 148, selected: true },
{ name: '二级', value: 87, selected: false },
{ name: '三级', value: 75, selected: false },
{ name: '四级', value: 40, selected: false },
],
label: {
formatter: '{b}{c}',
color: 'inherit',
},
},
],
},
chartOptionsRight: {
series: [
{
type: 'pie',
radius: ['32%', '50%'],
selectedMode: 'single',
data: [
{ name: 'I级', value: 137, selected: true },
{ name: 'II级', value: 105, selected: false },
{ name: 'III级', value: 58, selected: false },
{ name: 'IV级', value: 37, selected: false },
{ name: 'V级', value: 13, selected: false },
],
label: {
formatter: '{b}{c}',
color: 'inherit',
},
},
],
},
};
},
mounted() {
const echartsContainerLeft = this.$refs.echartsContainerLeft;
const chartLeft = echarts.init(echartsContainerLeft);
chartLeft.setOption(this.chartOptionsLeft);
const echartsContainerRight = this.$refs.echartsContainerRight;
const chartRight = echarts.init(echartsContainerRight);
chartRight.setOption(this.chartOptionsRight);
setInterval(() => {
let lastIndex = this.nowIndex++;
const leftData = this.chartOptionsLeft['series'][0]['data'];
leftData[lastIndex % 4]['selected'] = false;
leftData[this.nowIndex % 4]['selected'] = true;
chartLeft.setOption(this.chartOptionsLeft,true);
const rightData = this.chartOptionsRight['series'][0]['data'];
rightData[lastIndex % 5]['selected'] = false;
rightData[this.nowIndex % 5]['selected'] = true;
chartRight.setOption(this.chartOptionsRight,true);
}, 2000);
},
};
</script>
<style lang="scss" scoped>
.bottomLeft {
2 years ago
flex-basis: 38%;
.chartsBox {
width: 100%;
height: 100%;
display: flex;
position: relative;
padding-top: 10px;
box-sizing: border-box;
.chartItem {
width: 50%;
height: 100%;
flex-shrink: 0;
padding-top: 40px;
box-sizing: border-box;
p {
font-size: 24px;
text-align: center;
letter-spacing: 0.1vh;
}
.echartsContainer {
height: 90%;
}
}
}
}
</style>