-
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(word-cloud): 修复错误的边界值导致的重叠及间隙过大问题 (#1976)
* fix(word-cloud): 修复错误的边界值导致的重叠及间隙过大问题 * chore(word-cloud): 更改最小字体默认值
- Loading branch information
1 parent
ad96609
commit 24bd065
Showing
3 changed files
with
37 additions
and
11 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,28 @@ | ||
import { WordCloud } from '../../src'; | ||
import { CountryEconomy } from '../data/country-economy'; | ||
import { createDiv } from '../utils/dom'; | ||
|
||
describe('issue 1970', () => { | ||
it('bounds', () => { | ||
const cloud = new WordCloud(createDiv(), { | ||
width: 400, | ||
height: 300, | ||
data: CountryEconomy, | ||
wordField: 'Country', | ||
weightField: 'GDP', | ||
}); | ||
|
||
cloud.render(); | ||
|
||
const width = cloud.chart.ele.clientWidth; | ||
const height = cloud.chart.ele.clientHeight; | ||
|
||
// 最终的数据之中必须有这两个点表示画布的边界,才能正常渲染词云图 | ||
// @ts-ignore | ||
expect(cloud.chart.filteredData.some((v) => v.x === 0 && v.y === 0)).toBe(true); | ||
// @ts-ignore | ||
expect(cloud.chart.filteredData.some((v) => v.x === width && v.y === height)).toBe(true); | ||
|
||
cloud.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