Skip to content

Commit

Permalink
Merge pull request #767 from thundersdata-frontend/feat/3dpie
Browse files Browse the repository at this point in the history
fix: 修复3d饼图卡顿问题
  • Loading branch information
chj-damon authored Nov 20, 2023
2 parents 59c939a + 05d836a commit 579c9ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/five-teachers-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@td-design/lego': patch
---

修复3d饼图卡顿问题
4 changes: 2 additions & 2 deletions packages/lego/src/three-dimensional-pie/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ export default forwardRef<ReactEcharts, ThreeDimensionalPieProps>(
// 监听鼠标事件
useEffect(() => {
let hoveredIndex = '';
if (autoLoop) return;
if (echartsRef && seriesData) {
const myChart = getInstance();
myChart.on('mouseover', function (params: { seriesName?: string }) {
Expand All @@ -196,7 +197,7 @@ export default forwardRef<ReactEcharts, ThreeDimensionalPieProps>(
}
});
// 如果触发 mouseover 的扇形当前已高亮,则不做操作
if (autoLoop || hoveredIndex === seriesIndex) {
if (hoveredIndex === seriesIndex) {
return;
} else {
if (hoveredIndex !== '') {
Expand All @@ -212,7 +213,6 @@ export default forwardRef<ReactEcharts, ThreeDimensionalPieProps>(
});
}
hoveredIndex = hoveredIndex !== '' ? '' : seriesIndex;
setHoveredIndex(hoveredIndex);
myChart.setOption(option);
}
});
Expand Down

0 comments on commit 579c9ce

Please sign in to comment.