-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(issue-2161): 修复数据项存在非法 undefined 时,获取数据 max 为 NaN,导致玉珏图渲染页面崩溃
- Loading branch information
Showing
3 changed files
with
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { RadialBar } from '../../src'; | ||
import { createDiv } from '../utils/dom'; | ||
|
||
describe('#2161', () => { | ||
it('[玉珏图] 当某一数据项 value 为 undefined 时,页面崩溃', () => { | ||
const data = [ | ||
{ name: 'X6', star: 297 }, | ||
{ name: 'G' }, | ||
{ name: 'AVA', star: 805 }, | ||
{ name: 'G2Plot', star: 1478 }, | ||
{ name: 'L7', star: 2029 }, | ||
{ name: 'G6', star: 7100 }, | ||
{ name: 'F2', star: 7346 }, | ||
{ name: 'G2', star: 10178 }, | ||
]; | ||
|
||
const bar = new RadialBar(createDiv(), { | ||
width: 400, | ||
height: 300, | ||
data, | ||
xField: 'name', | ||
yField: 'star', | ||
radius: 0.8, | ||
innerRadius: 0.2, | ||
tooltip: { | ||
formatter: (datum) => { | ||
return { name: 'star数', value: datum.star }; | ||
}, | ||
}, | ||
}); | ||
bar.render(); | ||
|
||
expect(bar.chart).toBeDefined(); | ||
|
||
bar.destroy(); | ||
}); | ||
}); |
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