-
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: 对称条形图 meta 支持 yField 设置别名 (#2240)
* feat(bidirectional-bar): 对称条形图支持 meta 配置 由于内部进行了 series 分类以及数据转换,因此需将 yField 的别名通过 formatter 注入 * test: 添加对称条形图meta设置的单测 * docs: 一波文档修改 * fix: 修改 ci 单测问题
- Loading branch information
Showing
24 changed files
with
169 additions
and
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { BidirectionalBar } from '../../../../src'; | ||
import { SERIES_FIELD_KEY } from '../../../../src/plots/bidirectional-bar/constant'; | ||
import { data } from '../../../data/bi-directional'; | ||
import { createDiv } from '../../../utils/dom'; | ||
|
||
describe('Bidirectional', () => { | ||
it('进行别名设置', () => { | ||
const bidirectional = new BidirectionalBar(createDiv('default'), { | ||
width: 400, | ||
height: 400, | ||
data, | ||
xField: 'country', | ||
yField: ['2016年耕地总面积', '2016年转基因种植面积'], | ||
}); | ||
bidirectional.render(); | ||
|
||
expect(bidirectional.type).toEqual('bidirectional-bar'); | ||
|
||
// @ts-ignore | ||
let scalePool = bidirectional.chart.scalePool; | ||
const scaleKeys = scalePool.syncScales.get(SERIES_FIELD_KEY); | ||
|
||
expect(scalePool.scales.get(scaleKeys[0]).scaleDef.formatter('2016年耕地总面积')).toBe('2016年耕地总面积'); | ||
expect(scalePool.scales.get(scaleKeys[1]).scaleDef.formatter('2016年转基因种植面积')).toBe('2016年转基因种植面积'); | ||
|
||
bidirectional.update({ | ||
meta: { | ||
'2016年耕地总面积': { | ||
alias: 'a', | ||
}, | ||
'2016年转基因种植面积': { | ||
alias: 'b', | ||
}, | ||
}, | ||
}); | ||
|
||
// @ts-ignore | ||
scalePool = bidirectional.chart.scalePool; | ||
expect(scalePool.scales.get(scaleKeys[0]).scaleDef.formatter('2016年耕地总面积')).toBe('a'); | ||
expect(scalePool.scales.get(scaleKeys[1]).scaleDef.formatter('2016年转基因种植面积')).toBe('b'); | ||
|
||
bidirectional.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
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
Oops, something went wrong.