antvis / G2

📊 The concise and progressive visualization grammar.
https://g2.antv.antgroup.com
MIT License
12.08k stars 1.59k forks source link

More options on pack transform #5875

Closed YiSiWang closed 9 months ago

YiSiWang commented 9 months ago

问题描述

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

重现链接

No response

重现步骤

No response

预期行为

No response

平台

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

YiSiWang commented 9 months ago

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

pearmini commented 9 months 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" },
    },
  ],
});
pearmini commented 9 months ago

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

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

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

@YiSiWang 要不要搞搞!

YiSiWang commented 9 months ago

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

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

  • direction
  • padding
  • paddingX
  • paddingY

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

@YiSiWang 要不要搞搞!

这个有点太难了/狗头

Runtus commented 9 months ago

【Runtus】认领

Runtus commented 9 months ago

fix: #5964