Skip to content

Commit

Permalink
fix(label): 增加label单测,解决数据量过多,lable自动隐藏场景下报错问题
Browse files Browse the repository at this point in the history
  • Loading branch information
王学通 committed Mar 14, 2024
1 parent 4492c95 commit 6b0d07c
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/bugs/6114-spec.ts
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)

})
})

0 comments on commit 6b0d07c

Please sign in to comment.