1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
| import {ref, onMounted} from "vue"; const sum = ref({ buildingNumber: '100', residentsNumber: '888', intelligentDevices: '300', alarmNumber: '20' })
const buildingData = ref([ {value: 335, name: '毛坯房'}, {value: 310, name: '精装修'}, {value: 234, name: '简装修'}, {value: 135, name: '未卖出'}, ])
const repairData = ref([ {value: 335, name: '正在处理'}, {value: 310, name: '已修复'}, {value: 234, name: '未修复'}, ]) const paymentData = ref( { hasPay:[50, 80, 90, 400], noPay:[10,20,30,50] })
import * as echarts from 'echarts'
onMounted(() => { renderChart() })
const building = ref() const repairing = ref() const paying = ref() const renderChart = () => { let buildingChart = echarts.init(building.value) let repairChart = echarts.init(repairing.value) let payChart = echarts.init(paying.value) window.addEventListener("resize", () => { buildingChart.resize(); }); window.addEventListener("resize", () => { repairChart.resize(); }); window.addEventListener("resize", () => { payChart.resize(); }); buildingChart.setOption({ title: { text: '房屋分布', left: 'left' } , tooltip: { trigger: 'item',
} , legend: { orient: 'horizontal', bottom: '10px', data: ['毛坯房', '精装修', '简装修', '未卖出'] } , label: { show: true, formatter: '{b}:{c}' }, series: [ { name: '装修情况', type: 'pie', radius: '50%', center: ['50%', '50%'], data: buildingData.value, emphasis: { itemStyle: { shadowBlur: 10, shadowOffsetX: 5, shadowColor: 'rgba(0, 0, 0, 0.5)' } } } ] } ) repairChart.setOption({ title: { text: '报修情况', left: 'left' } , tooltip: { trigger: 'item',
}, label: { show: true, formatter:'{b}: {c}' }, legend: { orient: 'horizontal', bottom: '10px', data: ['正在处理', '已修复', '未修复'] } , series: [ { name: '报修情况', type: 'pie', radius: '50%', center: ['50%', '50%'], data: repairData.value, emphasis: { itemStyle: { shadowBlur: 10, shadowOffsetX: 5, shadowColor: 'rgba(0, 0, 0, 0.5)' } } } ] } ) payChart.setOption({ title: { text: '缴费情况', left: 'left' }, tooltip: { trigger: 'axis' }, legend: { orient: 'horizontal', bottom: '10px', data: ['已缴','未缴'] }, label: { show: true, position: 'top' }, xAxis: { data: ['水费', '电费', '停车费', '物业费'] }, yAxis: {}, series: [ { name: '已缴', type: 'bar', data: paymentData.value.hasPay },{ name: '未缴', type: 'bar', data: paymentData.value.noPay } ] }) }
|