antvis/G2

resize 的时候,右边的 legend 位置没有更新 #5302

pearmini posted onGitHub

Discussed in https://github.com/antvis/G2/discussions/5301

  • 问题:改变大小的时候 legend 的位置没有更新
  • 版本:5.0.15
import { Chart } from '@antv/g2';

const data = [
  { genre: 'Sports', sold: 275 },
  { genre: 'Strategy', sold: 115 },
  { genre: 'Action', sold: 120 },
  { genre: 'Shooter', sold: 350 },
  { genre: 'Other', sold: 150 },
];

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

chart
  .interval()
  .data(data)
  .encode('x', 'genre') 
  .encode('color', 'genre')
  .encode('y', 'sold')
  .legend('color', { position: 'right' });

chart.render();

Fund this Issue

$0.00
Funded

Pull requests