-
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(sankey): nodelink data supported (#2967)
* fix(funnel): do not mutable data * revert(funnel): clone data firstly * chore: remove unused import * feat(sankey): node link data supported
- Loading branch information
Showing
3 changed files
with
116 additions
and
17 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,38 @@ | ||
import { Sankey } from '../../../../src'; | ||
import { createDiv } from '../../../utils/dom'; | ||
|
||
describe('sankey', () => { | ||
it('dataType = nodeLink', () => { | ||
const ALIPAY_DATA = { | ||
nodes: [ | ||
{ id: 'A', name: 'A' }, | ||
{ id: 'B', name: 'B' }, | ||
{ id: 'C', name: 'C' }, | ||
{ id: 'D', name: 'D' }, | ||
{ id: 'E', name: 'E' }, | ||
{ id: 'F', name: 'F', fixedValue: 10 }, | ||
], | ||
links: [ | ||
{ source: 0, target: 1, value: 160 }, | ||
{ source: 1, target: 2, value: 10 }, | ||
{ source: 2, target: 3, value: 8 }, | ||
{ source: 4, target: 3, value: 27 }, | ||
], | ||
}; | ||
|
||
const sankey = new Sankey(createDiv(), { | ||
height: 500, | ||
dataType: 'node-link', | ||
data: ALIPAY_DATA, | ||
}); | ||
|
||
sankey.render(); | ||
|
||
const elements = sankey.chart.views[1].geometries[0].elements; | ||
|
||
// F 元素会现实出来 | ||
expect(elements.some((el) => el.getData().name === 'F')).toBe(true); | ||
|
||
sankey.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