antvis/G2




The issue has been closed
【V5】堆叠折线图.style('stroke')无法获取某条线的数据 #5807
KuduroJS posted onGitHub
问题描述
堆叠折线图.style('stroke')无法获取某条线的数据
面积图也有这个问题
demo如下:
import { Chart } from '@antv/g2';
const chart = new Chart({
container: 'container',
autoFit: true,
});
chart.data({
type: 'fetch',
value: 'https://assets.antv.antgroup.com/g2/unemployment-by-industry.json',
});
chart
.line()
.transform([
{ type: 'stackY' }, // Try to remove this line.
])
.encode('x', (d) => new Date(d.date))
.encode('y', 'unemployed')
.encode('color', 'industry')
.encode('shape', 'smooth')
.style('stroke', (datum, b, c, d) => {
console.log('stroke...', datum, b, c, d) // ! 这里无法获取当前row数据
return 'red'
})
;
chart.render();
重现链接
No response
重现步骤
console输出
预期行为
预期可以获取当前row数据,根据数据设置不同颜色
平台
- 操作系统: [macOS, Windows, Linux, React Native ...]
- 网页浏览器: [Google Chrome, Safari, Firefox]
屏幕截图或视频(可选)
No response
补充说明(可选)
No response