antvis/G2

柱状图同时设置scale.y.key和scrollbar,console会报错,滚动条失效 #5654

KuduroJS posted onGitHub

demo如下:

/**
 * A recreation of this demo: https://vega.github.io/vega-lite/examples/bar_grouped_repeated.html
 */
import { Chart } from '@antv/g2';

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

chart.data({
  type: 'fetch',
  value: 'https://assets.antv.antgroup.com/g2/movies.json',
});

chart
  .interval()
  .transform({ type: 'groupX', y: 'sum' })
  .axis('y', { labelFormatter: '~s' })
  .axis('x', { labelTransform: 'rotate(90)' })
  .encode('x', 'Major Genre')
  .encode('y', 'Worldwide Gross')
  .encode('series', () => 'Worldwide Gross')
  .encode('color', () => 'Worldwide Gross')
  .tooltip({ channel: 'y', valueFormatter: '~s' })
  .scale('y', {
    key: "left", // ! 设置这里滚动会失效
  })
  .scrollbar("x", {});

chart.render();

估计是类似的问题:https://github.com/antvis/G2/issues/5546

posted by pearmini over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests