-
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: tooltip controller isVisible not update (#2604)
* fix: tooltip controller isVisible not update * fix: 多折线或分组柱图中slider使用异常的问题 * test: 增加slider测试 * text: 添加了#2603测试 * fix: 优化代码写法 * fix: remove script test-bug * fix: groupScales length * fix: chart visible test Co-authored-by: weicai.wwc <[email protected]>
- Loading branch information
Showing
4 changed files
with
215 additions
and
12 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,147 @@ | ||
import { Chart } from '../../src'; | ||
import { createDiv } from '../util/dom'; | ||
|
||
describe('2295', () => { | ||
it('2295', () => { | ||
const data = [ | ||
{ | ||
city: 'Tokyo', | ||
month: 'Jan', | ||
temperature: 7, | ||
}, | ||
{ | ||
city: 'London', | ||
month: 'Jan', | ||
temperature: 3.9, | ||
}, | ||
{ | ||
city: 'Tokyo', | ||
month: 'Feb', | ||
temperature: 6.9, | ||
}, | ||
{ | ||
city: 'London', | ||
month: 'Feb', | ||
temperature: 4.2, | ||
}, | ||
{ | ||
city: 'Tokyo', | ||
month: 'Mar', | ||
temperature: 9.5, | ||
}, | ||
{ | ||
city: 'London', | ||
month: 'Mar', | ||
temperature: 5.7, | ||
}, | ||
{ | ||
city: 'Tokyo', | ||
month: 'Apr', | ||
temperature: 14.5, | ||
}, | ||
{ | ||
city: 'London', | ||
month: 'Apr', | ||
temperature: 8.5, | ||
}, | ||
{ | ||
city: 'Tokyo', | ||
month: 'May', | ||
temperature: 18.4, | ||
}, | ||
{ | ||
city: 'London', | ||
month: 'May', | ||
temperature: 11.9, | ||
}, | ||
{ | ||
city: 'Tokyo', | ||
month: 'Jun', | ||
temperature: 21.5, | ||
}, | ||
{ | ||
city: 'London', | ||
month: 'Jun', | ||
temperature: 15.2, | ||
}, | ||
{ | ||
city: 'Tokyo', | ||
month: 'Jul', | ||
temperature: 25.2, | ||
}, | ||
{ | ||
city: 'London', | ||
month: 'Jul', | ||
temperature: 17, | ||
}, | ||
{ | ||
city: 'Tokyo', | ||
month: 'Aug', | ||
temperature: 26.5, | ||
}, | ||
{ | ||
city: 'London', | ||
month: 'Aug', | ||
temperature: 16.6, | ||
}, | ||
{ | ||
city: 'Tokyo', | ||
month: 'Sep', | ||
temperature: 23.3, | ||
}, | ||
{ | ||
city: 'London', | ||
month: 'Sep', | ||
temperature: 14.2, | ||
}, | ||
{ | ||
city: 'Tokyo', | ||
month: 'Oct', | ||
temperature: 18.3, | ||
}, | ||
{ | ||
city: 'London', | ||
month: 'Oct', | ||
temperature: 10.3, | ||
}, | ||
{ | ||
city: 'Tokyo', | ||
month: 'Nov', | ||
temperature: 13.9, | ||
}, | ||
{ | ||
city: 'London', | ||
month: 'Nov', | ||
temperature: 6.6, | ||
}, | ||
{ | ||
city: 'Tokyo', | ||
month: 'Dec', | ||
temperature: 9.6, | ||
}, | ||
{ | ||
city: 'London', | ||
month: 'Dec', | ||
temperature: 4.8, | ||
}, | ||
]; | ||
const chart = new Chart({ | ||
container: createDiv(), | ||
width: 500, | ||
height: 300, | ||
appendPadding: [20], | ||
}); | ||
|
||
chart.data(data); | ||
chart.interval().position('month*temperature').color('city'); | ||
chart.tooltip({ shared: true }); | ||
chart.option('slider', { | ||
start: 0.2, | ||
end: 0.8, | ||
}); | ||
chart.render(); | ||
chart.render(); | ||
|
||
expect(chart.getData().length).toBe(Math.floor(data.length * (0.8 - 0.2))); | ||
}); | ||
}); |
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,37 @@ | ||
import { Chart } from '../../src'; | ||
import { createDiv } from '../util/dom'; | ||
|
||
describe('2570', () => { | ||
it('2570', () => { | ||
const data = [ | ||
{ year: '1991', value: 3 }, | ||
{ year: '1992', value: 4 }, | ||
{ year: '1993', value: 3.5 }, | ||
{ year: '1994', value: 5 }, | ||
{ year: '1995', value: 4.9 }, | ||
{ year: '1996', value: 6 }, | ||
{ year: '1997', value: 7 }, | ||
{ year: '1998', value: 9 }, | ||
{ year: '1999', value: 13 }, | ||
]; | ||
const chart = new Chart({ | ||
container: createDiv(), | ||
width: 500, | ||
height: 300, | ||
appendPadding: [20], | ||
}); | ||
|
||
chart.data(data); | ||
chart.axis(false); | ||
chart.tooltip(false); | ||
chart.line().position('year*value'); | ||
chart.render(); | ||
const tooltipController: any = chart.getController('tooltip'); | ||
expect(tooltipController.isVisible()).toEqual(false); | ||
|
||
setTimeout(() => { | ||
chart.tooltip({ shared: true }); | ||
expect(tooltipController.isVisible()).toEqual(true); | ||
}, 500); | ||
}); | ||
}); |