antvis/G2

The issue has been closed
[v5] 实现带 point 的堆叠折线图 #4515
visiky posted onGitHub
期望效果
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15646325/209423419-d1253b30-3908-43b9-98c0-455f4b1f7557.png">
代码
import { Chart } from '@antv/g2';
const chart = new Chart({
container: 'container',
height: 380
});
chart.data({
type: "fetch",
value:
"https://gw.alipayobjects.com/os/bmw-prod/55424a73-7cb8-4f79-b60d-3ab627ac5698.json"
})
chart
.line()
.encode('x', d => new Date(d.year))
.encode('y', 'value')
.encode('color', 'category')
.transform({ type: 'stackY' })
chart
.point()
.encode('x', d => new Date(d.year))
.encode('y', 'value')
.encode('color', 'category')
.transform({ type: 'stackY' })
chart.render();
实际效果
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15646325/209423890-b129cef7-b222-41a9-a004-169d15285861.png">