Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(animate): 修复饼图动画无角度变化时其余属性未更新问题 #5892

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/animate/animation/sector-path-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function sectorPathUpdate(shape: IShape, animateCfg: GAnimateCfg, cfg: An
const diffEndAngle = curEndAngle - preEndAngle;
// 没有 diff 时直接返回最终 attrs,不需要额外动画
if (diffStartAngle === 0 && diffEndAngle === 0) {
shape.attr('path', path);
shape.attr(toAttrs);
return;
}

Expand Down
34 changes: 34 additions & 0 deletions tests/bugs/pie-update-animate-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Chart } from '../../src';
import { createDiv } from '../util/dom';

describe('pie update animate', () => {
it('pie should update other attribute without angle change', () => {
const data = [
{ type: '一线城市', value: 20 },
{ type: '二线城市', value: 0 },
{ type: '三线城市', value: 10 },
];
const chart = new Chart({
container: createDiv(),
width: 600,
height: 300,
autoFit: true,
});
chart.data(data);

chart.coordinate('theta', {
radius: 0.75,
});

const interval = chart.interval().adjust('stack').position('value').color('type', ['blue', 'green', 'yellow']);
chart.render();

const shape = interval.elements[0].shape;

interval.color('type', ['#ff0000']);
chart.render(true);
expect(shape.attr('fill')).toEqual('#ff0000');

chart.destroy();
});
});