antvis/G2

More options on pack transform #5875

YiSiWang posted onGitHub

问题描述

<img width="1293" alt="image" src="https://github.com/antvis/G2/assets/20316342/f0756cad-db57-470f-ae83-0566800d3f67">

  1. 希望 pack 能支持更多的参数,如从左向右进行堆叠,而非固定的从下到上;支持指定 pack 的间距等。
  2. facetRect 等分面 Mark 似乎不支持 .tooltip 等交互相关的能力?

重现链接

No response

重现步骤

No response

预期行为

No response

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response


PS facetRect 的 padding margin inset 好像都不起作用: https://g2.antv.antgroup.com/zh/examples/composition/facet/#rect-bar

posted by YiSiWang over 1 year ago

PS facetRect 的 padding margin inset 好像都不起作用

@YiSiWang 分面的 padding margin inset 在 API 里面是在 new Chart 的时候指定:

const chart = new Chart({
  container: 'container',
  width: 928,
  height: 320,
  paddingLeft: 60,
  paddingBottom: 60,
});

在 Spec 里面可以可以在 facet 指定:

({
  type: "facetRect",
  width: 928,
  height: 320,
  paddingLeft: 60,
  paddingBottom: 60,
  data: {
    type: "fetch",
    value: "https://assets.antv.antgroup.com/g2/anscombe.json",
  },
  encode: { x: "series" },
  children: [
    {
      type: "point",
      inset: 10,
      encode: { x: "x", y: "y" },
      style: { stroke: "#000" },
    },
  ],
});
posted by pearmini over 1 year ago

希望 pack 能支持更多的参数,如从左向右进行堆叠,而非固定的从下到上;支持指定 pack 的间距等。

这个目前确实不支持,可以考虑给 pack 增加如下参数:

  • direction
  • padding
  • paddingX
  • paddingY

相关代码在这里:https://github.com/antvis/G2/blob/v5/src/transform/pack.ts

@YiSiWang 要不要搞搞!

posted by pearmini over 1 year ago

希望 pack 能支持更多的参数,如从左向右进行堆叠,而非固定的从下到上;支持指定 pack 的间距等。

这个目前确实不支持,可以考虑给 pack 增加如下参数:

  • direction
  • padding
  • paddingX
  • paddingY

相关代码在这里:https://github.com/antvis/G2/blob/v5/src/transform/pack.ts

@YiSiWang 要不要搞搞!

这个有点太难了/狗头

posted by YiSiWang over 1 year ago

【Runtus】认领

posted by Runtus over 1 year ago

fix: #5964

posted by Runtus over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests