-
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(bullet): 修复轴组件添加max时,子弹图scale呈现不正确问题 (#2639)
* fix(bullet): 修复轴组件添加max时,子弹图scale呈现不正确问题 * fix(bullet): 规范写法,将sync改为true,同步自身 Co-authored-by: 酥云 <lisuwen.lsw@antgroup.com>
- Loading branch information
Showing
2 changed files
with
51 additions
and
1 deletion.
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,50 @@ | ||
import { Bullet } from '../../src/plots/bullet'; | ||
import { createDiv } from '../utils/dom'; | ||
|
||
const data = [ | ||
{ | ||
title: 'Test data point', | ||
measures: [80], | ||
ranges: [100], | ||
target: 85, | ||
}, | ||
]; | ||
|
||
describe('#2636', () => { | ||
it('yAxisMax', () => { | ||
const bullet = new Bullet(createDiv('yAxisMax bullet'), { | ||
data, | ||
measureField: 'measures', | ||
rangeField: 'ranges', | ||
targetField: 'target', | ||
xField: 'title', | ||
color: { | ||
range: '#f0efff', | ||
measure: '#5B8FF9', | ||
target: '#3D76DD', | ||
}, | ||
xAxis: { | ||
line: null, | ||
}, | ||
yAxis: { | ||
max: 200, | ||
}, | ||
}); | ||
|
||
bullet.render(); | ||
|
||
const chart = bullet.chart; | ||
const scales = chart.geometries[0].scales; // 拿到比例尺 | ||
|
||
const scaleMeasureMax = scales.measures.max; | ||
expect(scaleMeasureMax).toBe(200); | ||
|
||
const scaleRangesMax = scales.ranges.max; | ||
expect(scaleRangesMax).toBe(200); | ||
|
||
const scaleTargetMax = scales.target.max; | ||
expect(scaleTargetMax).toBe(200); | ||
|
||
bullet.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