-
Notifications
You must be signed in to change notification settings - Fork 607
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(dual-axes): 修复双轴图缩略缺失start或end丢失右侧view问题
- Loading branch information
liwenbo
committed
Dec 6, 2023
1 parent
66ea0f0
commit 1ab71a6
Showing
2 changed files
with
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { DualAxes } from '../../src'; | ||
import { createDiv } from '../utils/dom'; | ||
|
||
describe('dual-axes slider', () => { | ||
const data = [ | ||
{ time: '2019-03', value: 350, count: 800 }, | ||
{ time: '2019-04', value: 900, count: 600 }, | ||
{ time: '2019-05', value: 300, count: 400 }, | ||
{ time: '2019-06', value: 450, count: 380 }, | ||
{ time: '2019-07', value: 470, count: 220 }, | ||
]; | ||
|
||
it('slider left view should have data', () => { | ||
const dualAxes = new DualAxes(createDiv(), { | ||
data: [data, data], | ||
xField: 'time', | ||
yField: ['value', 'count'], | ||
slider: { | ||
end: 1, | ||
}, | ||
geometryOptions: [ | ||
{ | ||
geometry: 'column', | ||
}, | ||
{ | ||
geometry: 'line', | ||
lineStyle: { | ||
lineWidth: 2, | ||
}, | ||
}, | ||
], | ||
}); | ||
|
||
dualAxes.render(); | ||
const filterData = dualAxes.chart.views[1].getData(); | ||
expect(filterData.length).toBeGreaterThan(0); | ||
expect(filterData).toEqual(data); | ||
|
||
dualAxes.destroy(); | ||
}); | ||
|
||
it('dual axes should have same data', () => { | ||
const dualAxes = new DualAxes(createDiv(), { | ||
data: [data, data], | ||
xField: 'time', | ||
yField: ['value', 'count'], | ||
slider: { | ||
end: 0.9, | ||
}, | ||
geometryOptions: [ | ||
{ | ||
geometry: 'column', | ||
}, | ||
{ | ||
geometry: 'line', | ||
lineStyle: { | ||
lineWidth: 2, | ||
}, | ||
}, | ||
], | ||
}); | ||
|
||
dualAxes.render(); | ||
|
||
const columnFilterData = dualAxes.chart.views[0].getData(); | ||
const lineFilterData = dualAxes.chart.views[1].getData(); | ||
expect(columnFilterData).toEqual(lineFilterData); | ||
|
||
dualAxes.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