-
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: 面积图支持 startOnZero * docs: 美化文档 * fix: 添加 series field 判断 Co-authored-by: liufu.lf <liufu.lf@antfin.com>
- Loading branch information
Showing
7 changed files
with
97 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Area } from '../../../../src'; | ||
import { createDiv } from '../../../utils/dom'; | ||
|
||
describe('area', () => { | ||
it('start on zero', () => { | ||
const data = [ | ||
{ date: '19/05/2006', type: 'FF', value: 3600 }, | ||
{ date: '19/06/2006', type: 'FG', value: 2500 }, | ||
{ date: '19/07/2006', type: 'Lab', value: -2000 }, | ||
{ date: '19/08/2006', type: 'SF', value: 800 }, | ||
{ date: '19/09/2006', type: 'Ind/Oth', value: 1700 }, | ||
]; | ||
const area = new Area(createDiv(), { | ||
width: 400, | ||
height: 300, | ||
data, | ||
xField: 'date', | ||
yField: 'value', | ||
startOnZero: false, | ||
isStack: false, | ||
}); | ||
|
||
area.render(); | ||
const geometry = area.chart.geometries[0]; | ||
// @ts-ignore | ||
expect(geometry.startOnZero).toBeFalsy(); | ||
expect(area.chart.getScaleByField('value').min).toBe(-2000); | ||
area.update({ | ||
startOnZero: true, | ||
}); | ||
// @ts-ignore | ||
expect(area.chart.geometries[0].startOnZero).toBeTruthy(); | ||
area.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