antvis/G2
The issue has been closed
chart.emit('brushHighlight') 框和高亮颜色不匹配 #5028
pearmini posted onGitHub
- 版本:5.0.6
import { Chart } from '@antv/g2';
export const data = [
{ date: '2001-01', value: 100 },
{ date: '2001-02', value: 400 },
{ date: '2001-03', value: 500 },
{ date: '2001-04', value: 600 },
{ date: '2001-05', value: 300 },
{ date: '2001-06', value: 600 },
{ date: '2001-07', value: 300 },
{ date: '2001-08', value: 600 },
{ date: '2001-09', value: 109 },
{ date: '2001-10', value: 100 },
{ date: '2001-11', value: 102 },
{ date: '2001-12', value: 103 },
{ date: '2002-01', value: 102 },
{ date: '2002-02', value: 101 },
{ date: '2002-03', value: 200 },
{ date: '2002-04', value: 500 },
{ date: '2002-05', value: 100 },
{ date: '2002-06', value: 100 },
{ date: '2002-07', value: 102 },
{ date: '2002-08', value: 109 },
];
const chart = new Chart({
container: 'container',
theme: 'classic',
paddingBottom: 80,
});
chart
.interval()
.data(data)
.encode('x', 'date')
.encode('y', 'value')
.interaction('brushXHighlight', true);
chart.render().then((chart) => {
const X = ['2001-01', '2001-03'];
chart.emit('brush:highlight', {
data: { selection: [X, [-Infinity, Infinity]] },
});
});