-
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.
feat(sunburst): 旭日图增加一些字段元信息,如 同层级节点位置索引,祖先节点,儿子节点数量等 (#2679)
* feat(sunburst): 旭日图增加一些字段元信息,如 同层级节点位置索引,祖先节点,儿子节点数量等 - [x] demo - [x] dcos - [x] testcases * docs: 更新 antv-gastby-theme 版本 & 更新网站公告 * docs: 旭日图 demo 更新提示 * feat: 修改下 hierarchy 方法, 修复单测 * fix: 修复单测报错
- Loading branch information
Showing
11 changed files
with
163 additions
and
29 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,39 @@ | ||
import { Sunburst } from '../../../../src'; | ||
import { createDiv } from '../../../utils/dom'; | ||
import { SIMPLE_SUNBURST_DATA } from '../../../data/sunburst'; | ||
|
||
describe('sunburst: 字段信', () => { | ||
const div = createDiv(); | ||
const plot = new Sunburst(div, { | ||
data: SIMPLE_SUNBURST_DATA, | ||
}); | ||
plot.render(); | ||
|
||
it('节点位置索引:nodeIndex', () => { | ||
const data = plot.chart.getData(); | ||
|
||
expect(data[0].nodeIndex).toBe(0); | ||
expect(data[1].nodeIndex).toBe(1); | ||
|
||
expect(data[3].nodeIndex).toBe(0); | ||
}); | ||
|
||
it('儿子节点数量:childNodeCount', () => { | ||
const data = plot.chart.getData(); | ||
|
||
expect(data[0].childNodeCount).toBe( | ||
SIMPLE_SUNBURST_DATA.children.find((c) => c.name === data[0].name).children.length | ||
); | ||
}); | ||
|
||
it('组件节点: ancestors', () => { | ||
const data = plot.chart.getData(); | ||
|
||
expect(data[0][Sunburst.NODE_ANCESTORS_FIELD].length).toBe(0); | ||
expect(data[3][Sunburst.NODE_ANCESTORS_FIELD].length).toBe(1); | ||
}); | ||
|
||
afterAll(() => { | ||
plot.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
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