antvis/G2

极坐标系 auto Inset? #5049

pearmini posted onGitHub

  • 问题:极坐标系的 axis label 可能和图例重合
  • 解决办法:auto Inset 计算一下 inset?
  • 版本:5.0.7

<img src="https://github.com/antvis/G2/assets/49330279/77531112-c54a-48c8-9da8-e9ede6e84b52" width=640 />

export function scoreByItemAreaRadar(): G2Spec {
  return {
    type: 'view',
    data: scoreByItem,
    coordinate: { type: 'polar' },
    axis: {
      x: { grid: true },
      y: { zIndex: 1, title: false, direction: 'center' },
    },
    scale: {
      x: { padding: 0.5, align: 0 },
      y: { tickCount: 5 },
    },
    legend: { color: { layout: { justifyContent: 'flex-start' } } },
    children: [
      {
        type: 'area',
        encode: { x: 'item', y: 'score', color: 'type' },
        style: { fillOpacity: 0.5 },
      },
      {
        type: 'line',
        encode: { x: 'item', y: 'score', color: 'type' },
        style: { lineWidth: 2 },
      },
    ],
  };
}

Fund this Issue

$0.00
Funded

Pull requests