Closed Deathsteps closed 9 months ago
首次生效效果
关闭图例
再打开图例
图例开关不影响元素高亮效果
官方代码修改
/** * A recreation of this demo: https://observablehq.com/@d3/grouped-bar-chart */ import { Chart } from '@antv/g2'; const chart = new Chart({ container: 'container', autoFit: true, }); chart.title({ title: 'Population by age and state', subtitle: 'It shows the population of U.S. by age and state.', }); chart .interval() .data({ type: 'fetch', value: 'https://gw.alipayobjects.com/os/bmw-prod/f129b517-158d-41a9-83a3-3294d639b39e.csv', format: 'csv', }) .transform({ type: 'sortX', by: 'y', reverse: true, slice: 6 }) .transform({ type: 'dodgeX' }) .encode('x', 'state') .encode('y', 'population') .encode('color', 'age') .scale('y', { nice: true }) .axis('y', { labelFormatter: '~s' }); chart .state('inactive', { opacity: 0.5 }) .interaction('tooltip', { shared: true }) .interaction('elementHighlightByColor', { background: true, link: false, }); chart.render();
有可能是 elementHighlight 交互没有重新挂载。
没有修复成功呢,使用上述代码在官网测试,没有通过
@pearmini
问题描述
首次生效效果
关闭图例
再打开图例
期望结果
图例开关不影响元素高亮效果
如何重现
官方代码修改
额外信息