antvis/G2

Do you want to work on this issue?

You can request for a bounty in order to promote it!

阶梯折线图转换坐标系后,线条少了一截 #6287

juanhuang99 posted onGitHub

问题描述

代码如下: import { Chart } from '@antv/g2';

const data = [ { month: 'Jan', value: 51 }, { month: 'Feb', value: 91 }, { month: 'Mar', value: 34 }, { month: 'Apr', value: 47 }, { month: 'May', value: 63 }, { month: 'June', value: 58 }, { month: 'July', value: 56 }, { month: 'Aug', value: 77 }, { month: 'Sep', value: 99 }, { month: 'Oct', value: 106 }, { month: 'Nov', value: 88 }, { month: 'Dec', value: 56 }, ];

const chart = new Chart({ container: 'container', autoFit: true, });

chart .line() .data(data) .encode('x', 'month') .encode('y', 'value') .encode('shape', 'hv') .scale('x', { range: [0, 1], }) .scale('y', { nice: true, }) .coordinate({ transform: [{ type: 'transpose' }] });

chart.render();

不转换坐标,去掉.coordinate({ transform: [{ type: 'transpose' }] })的效果: image

转换坐标,加上.coordinate({ transform: [{ type: 'transpose' }] })的效果: image

预期行为

转换坐标后,折线的绘制能和转换前一致,效果如下: image


Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests