|
|
|
@ -19,7 +19,7 @@ export default class Pie extends Component { |
|
|
|
}; |
|
|
|
|
|
|
|
componentDidMount() { |
|
|
|
this.getLengendData(); |
|
|
|
this.getLegendData(); |
|
|
|
this.resize(); |
|
|
|
window.addEventListener('resize', this.resize); |
|
|
|
} |
|
|
|
@ -33,7 +33,7 @@ export default class Pie extends Component { |
|
|
|
legendData: [...this.state.legendData], |
|
|
|
}, |
|
|
|
() => { |
|
|
|
this.getLengendData(); |
|
|
|
this.getLegendData(); |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
@ -49,7 +49,7 @@ export default class Pie extends Component { |
|
|
|
}; |
|
|
|
|
|
|
|
// for custom lengend view
|
|
|
|
getLengendData = () => { |
|
|
|
getLegendData = () => { |
|
|
|
if (!this.chart) return; |
|
|
|
const geom = this.chart.getAllGeoms()[0]; // 获取所有的图形
|
|
|
|
const items = geom.get('dataArray') || []; // 获取图形对应的
|
|
|
|
|