antvis/G2

G2 设置padding后legend位置错误 #3714

gonenoob posted onGitHub

  • I have searched the issues of this repository and believe that this is not a duplicate.

Edit on CodeSandbox

Steps to reproduce

例子中设置了padding,但是legend的渲染位置并不是在canvas的底部,而是和底部有差不多20px的距离,这和https://g2.antv.vision/zh/docs/api/general/chart#chartcfgpadding 文档中定义的不一致。在 https://codesandbox.io/s/g4pce 里又是没有20px的距离的,求解

Environment Info
g2 4.1.32
System mac
Browser chrome 95

<!-- generated by antv-issue-helper. DO NOT REMOVE -->


观察很细致,原因是折线图图例的 marker 图形占位大一些。可以手动修改一下:

chart.legend('city', {
  maxHeight: 10,
  itemHeight: 10,
})
posted by hustcc almost 3 years ago

Fund this Issue

$0.00
Funded

Pull requests