-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(animate): 修复饼图动画无角度变化时其余属性未更新问题 (#5892)
Co-authored-by: liwenbo <[email protected]>
- Loading branch information
1 parent
9f8db50
commit f6ce41e
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |