-
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: treemap, 增加 view-zoom 时, 阻止默认滚动事件 * feat: 允许配置纵横比 * fix: 恢复 ratio 逻辑 * feat: 更新文档 * fix: 更新文档&测试用例 * feat: 新增测试用例 * feat: 更新测试用例 Co-authored-by: aiyin.lzy <nadia.lzy@antfin.com>
- Loading branch information
1 parent
6cb7eb1
commit c849383
Showing
9 changed files
with
113 additions
and
26 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
__tests__/unit/plots/treemap/interactions/view-zoom-spec.ts
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,36 @@ | ||
import { Treemap } from '../../../../../src'; | ||
import { createDiv } from '../../../../utils/dom'; | ||
import { TREEMAP } from '../../../../data/treemap'; | ||
|
||
describe('treemap view zoom interaction', () => { | ||
it('basic treemap', async () => { | ||
const treemapPlot = new Treemap(createDiv(), { | ||
data: TREEMAP, | ||
colorField: 'name', | ||
}); | ||
|
||
treemapPlot.render(); | ||
|
||
// 默认不开启 | ||
expect(treemapPlot.chart.getCanvas().getEvents().mousewheel).toBeUndefined(); | ||
|
||
// 开启 | ||
treemapPlot.update({ | ||
interactions: [{ type: 'view-zoom' }, { type: 'drag-move' }], | ||
}); | ||
|
||
const mousewheelEvent = treemapPlot.chart.getCanvas().getEvents().mousewheel; | ||
|
||
expect(Array.isArray(mousewheelEvent)).toBeTruthy(); | ||
expect(mousewheelEvent.length).toBe(1); | ||
|
||
// 关闭 | ||
treemapPlot.update({ | ||
interactions: [{ type: 'view-zoom', enable: false }], | ||
}); | ||
|
||
expect(treemapPlot.chart.getCanvas().getEvents().mousewheel).toBeUndefined(); | ||
|
||
treemapPlot.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
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
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
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