-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(axis): 修复转置极坐标无法配置坐标轴的问题。Closed #1744
- Loading branch information
Showing
2 changed files
with
58 additions
and
5 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,45 @@ | ||
import { Chart } from '../../src'; | ||
import { createDiv } from '../util/dom'; | ||
import { COMPONENT_TYPE } from '../../src/constant'; | ||
|
||
describe('1744', () => { | ||
const data = [ | ||
{ question: '问题 1', percent: 0.21 }, | ||
{ question: '问题 2', percent: 0.4 }, | ||
{ question: '问题 3', percent: 0.49 }, | ||
{ question: '问题 4', percent: 0.52 }, | ||
{ question: '问题 5', percent: 0.53 }, | ||
{ question: '问题 6', percent: 0.84 }, | ||
{ question: '问题 7', percent: 1.0 }, | ||
{ question: '问题 8', percent: 1.2 }, | ||
]; | ||
|
||
const chart = new Chart({ | ||
container: createDiv(), | ||
width: 400, | ||
height: 300, | ||
}); | ||
|
||
chart.data(data); | ||
chart.coordinate('polar', { innerRadius: 0.1 }).transpose(); | ||
|
||
chart | ||
.interval() | ||
.position('question*percent') | ||
.color('percent', '#BAE7FF-#1890FF-#0050B3'); | ||
chart.render(); | ||
|
||
it('Not render by default', () => { | ||
const axes = chart.getComponents().filter((co) => co.type === COMPONENT_TYPE.AXIS); | ||
expect(axes.length).toBe(0); | ||
}); | ||
|
||
it('But can be opened by chart.axis()', () => { | ||
chart.axis('question', true); | ||
chart.axis('percent', true); | ||
|
||
chart.render(true); | ||
const axes = chart.getComponents().filter((co) => co.type === COMPONENT_TYPE.AXIS); | ||
expect(axes.length).toBe(2); | ||
}); | ||
}); |