Skip to content

图表y通道设置domain范围后,图表渲染超出应绘制区域 #5195

Answered by pearmini
xyr550 asked this question in Q&A
Discussion options

You must be logged in to vote

使用 chart.clip 属性:

import { Chart } from '@antv/g2';

const chart = new Chart({
  container: 'container',
  theme: 'classic',
  autoFit: true,
  clip:true, // 设置这里
});

chart
  .interval()
  .data({
    type: 'fetch',
    value:
      'https://gw.alipayobjects.com/os/bmw-prod/fb9db6b7-23a5-4c23-bbef-c54a55fee580.csv',
  })
  .encode('x', 'letter')
  .encode('y', 'frequency')
  .scale('y', {domain: [0.01, 0.05]})
  .axis('y', { labelFormatter: '.0%' });

chart.render();

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pearmini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants