-
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: treemap layout optimize (#2337)
* feat(treemap): add sort layout option, add default sort is desc * test: fix ci
- Loading branch information
Showing
11 changed files
with
51 additions
and
9 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Treemap } from '../../../../src'; | ||
import { createDiv } from '../../../utils/dom'; | ||
import { TREEMAP } from '../../../data/treemap'; | ||
|
||
describe('treemap sort', () => { | ||
it('treemap sort', () => { | ||
const treemapPlot = new Treemap(createDiv(), { | ||
data: TREEMAP, | ||
colorField: 'name', | ||
}); | ||
|
||
treemapPlot.render(); | ||
|
||
// 1. 图形经过排序 | ||
// @ts-ignore | ||
expect(treemapPlot.chart.geometries[0].elements[0].getModel().data.name).toBe('分类 2'); | ||
// @ts-ignore | ||
expect(treemapPlot.chart.geometries[0].elements[0].getModel().data.value).toBe(800); | ||
// @ts-ignore | ||
expect(treemapPlot.chart.geometries[0].elements[1].getModel().data.name).toBe('分类 1'); | ||
// @ts-ignore | ||
expect(treemapPlot.chart.geometries[0].elements[1].getModel().data.value).toBe(500); | ||
|
||
// 2. reflect y | ||
// @ts-ignore | ||
expect(treemapPlot.chart.getCoordinate().isReflectY).toBe(true); | ||
|
||
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