|
|
|
@ -202,12 +202,24 @@ export default { |
|
|
|
{value: pandectData.rentOut, name: "出租"}, |
|
|
|
{value: pandectData.vacantHouse, name: "闲置"}, |
|
|
|
]; |
|
|
|
const temp = [...this.pieData,{value:pandectData.homeCount, name: "总数"}] |
|
|
|
this.pieOption.series[0].data = this.pieData; |
|
|
|
console.log(this.pieOption, 'this.pieOption.series') |
|
|
|
this.$refs.pieChart.setOption(this.pieOption); |
|
|
|
let than = this |
|
|
|
let currentIndex = 0; |
|
|
|
//饼状图点击事件 |
|
|
|
this.$refs.pieChart.myChart.off('click').on('click', (param) =>{ //这里使用箭头函数代替function,this指向VueComponent |
|
|
|
let index; |
|
|
|
currentIndex = (currentIndex + 1) %temp.length; |
|
|
|
const currentData =temp[currentIndex]; |
|
|
|
const percentage = ((currentData.value / pandectData.homeCount) * 100).toFixed(2); |
|
|
|
than.$refs.pieChart.myChart.setOption({ |
|
|
|
title: { |
|
|
|
text:currentData.name == '总数'?pandectData.homeCount: `${percentage}%`, |
|
|
|
subtext: currentData.name, |
|
|
|
} |
|
|
|
}); |
|
|
|
let index; |
|
|
|
//当前扇区的dataIndex |
|
|
|
index = param.dataIndex; |
|
|
|
//自己的操作,这里是点击跳转路由,并携带参数 |
|
|
|
|