-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(label): 增加label单测,解决数据量过多,lable自动隐藏场景下报错问题
- Loading branch information
王学通
committed
Mar 14, 2024
1 parent
4492c95
commit 6b0d07c
Showing
1 changed file
with
48 additions
and
0 deletions.
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,48 @@ | ||
import { Chart } from '../../src'; | ||
import { createDiv } from '../util/dom'; | ||
import { delay } from '../util/delay'; | ||
|
||
/** | ||
* 增加 label -->> layout 特定情况报错 | ||
* 报错详情具体查看 https://github.com/antvis/G2/issues/6114 | ||
* 此问题在G代码中修复掉了 | ||
* | ||
*/ | ||
describe('#6114', () => { | ||
it('dual-axes-label-layout.spec', async () => { | ||
|
||
const group = Array.from({ length: 500 }, (value, index) => { | ||
return { | ||
time: index, | ||
waiting: index * (Math.random() * 10), | ||
people: index * (Math.random() * 10), | ||
} | ||
}) | ||
|
||
const chart = new Chart({ | ||
container: createDiv(), | ||
autoFit: true, | ||
height: 500 | ||
}); | ||
chart.data(group); | ||
chart.interval() | ||
.position('time*waiting') | ||
.color('#3182bd') | ||
.label('waiting', { | ||
layout: [{ type: 'limit-in-plot', }], | ||
}) | ||
chart.line() | ||
.position('time*people') | ||
.color('#fdae6b') | ||
.size(3) | ||
.shape('smooth') | ||
.label('people', { | ||
layout: [{ type: 'overlap' }, { type: 'limit-in-plot', cfg: { action: 'translate' } },], | ||
}) | ||
|
||
|
||
chart.render(); | ||
// await delay(20) | ||
|
||
}) | ||
}) |