Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: 优化散点图 * fix: 修复散点图 field 相关逻辑 * fix: tests Co-authored-by: liufu.lf <liufu.lf@antfin.com>
- Loading branch information
Showing
10 changed files
with
134 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { Scatter } from '../../../../src'; | ||
import { data } from '../../../data/gender'; | ||
import { createDiv } from '../../../utils/dom'; | ||
|
||
describe('scatter', () => { | ||
it('legend: false', () => { | ||
const scatter = new Scatter(createDiv(), { | ||
width: 400, | ||
height: 300, | ||
appendPadding: 10, | ||
data, | ||
xField: 'weight', | ||
yField: 'height', | ||
shapeField: 'gender', | ||
xAxis: { | ||
nice: true, | ||
}, | ||
legend: false, | ||
}); | ||
|
||
scatter.render(); | ||
const legendController = scatter.chart.getController('legend'); | ||
// @ts-ignore | ||
const { option } = legendController; | ||
expect(option).toBeUndefined(); | ||
}); | ||
|
||
it('legend: true', () => { | ||
const scatter = new Scatter(createDiv(), { | ||
width: 400, | ||
height: 300, | ||
appendPadding: 10, | ||
data, | ||
xField: 'weight', | ||
yField: 'height', | ||
shapeField: 'gender', | ||
shape: ['circle', 'square'], | ||
colorField: 'gender', | ||
xAxis: { | ||
nice: true, | ||
}, | ||
legend: true, | ||
}); | ||
|
||
scatter.render(); | ||
|
||
const legendController = scatter.chart.getController('legend'); | ||
// @ts-ignore | ||
const { option } = legendController; | ||
expect(option).not.toBeUndefined(); | ||
expect(legendController.getComponents().length).toBe(1); | ||
expect(legendController.getComponents()[0].id).toBe('legend-gender'); | ||
}); | ||
it('legend: postion options', () => { | ||
const scatter = new Scatter(createDiv(), { | ||
width: 400, | ||
height: 300, | ||
appendPadding: 10, | ||
data, | ||
xField: 'weight', | ||
yField: 'height', | ||
shapeField: 'gender', | ||
shape: ['circle', 'square'], | ||
colorField: 'gender', | ||
xAxis: { | ||
nice: true, | ||
}, | ||
legend: { | ||
position: 'top-right', | ||
}, | ||
}); | ||
|
||
scatter.render(); | ||
|
||
const legendController = scatter.chart.getController('legend'); | ||
// @ts-ignore | ||
const { option } = legendController; | ||
expect(option).not.toBeUndefined(); | ||
expect(legendController.getComponents().length).toBe(1); | ||
expect(legendController.getComponents()[0].id).toBe('legend-gender'); | ||
expect(legendController.getComponents()[0].direction).toBe('top-right'); | ||
}); | ||
}); |
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
1 comment
on commit 5f67f6f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这么改了之后,demo 都 review 过一遍吗?
这个 color 为啥去掉了?