Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: interval shape has max/min width #5123

Merged
merged 3 commits into from
May 30, 2023
Merged

feat: interval shape has max/min width #5123

merged 3 commits into from
May 30, 2023

Conversation

hustcc
Copy link
Member

@hustcc hustcc commented May 30, 2023

fixed #5118

  • minWidth, maxWidth options
  • add test cases
  • add docs and demo
import { Chart } from '@antv/g2';

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

chart
  .interval()
  .data([{ letter: 'A', frequency: 120 }])
  .encode('x', 'letter')
  .encode('y', 'frequency')
  .scale('x', { padding: 0.5 })
  // .style('minWidth', 500)
  .style('maxWidth', 200); // 👈🏻 这里设置

chart.render();

image

@pearmini
Copy link
Member

话说 minWidth 真的有用吗?如果使用了 minWidth,岂不是说明图表重叠了?

@hustcc
Copy link
Member Author

hustcc commented May 30, 2023

话说 minWidth 真的有用吗?如果使用了 minWidth,岂不是说明图表重叠了?

只能说 padding 设置很大的时候,设置 minWidth 有一定作用。但是实际场景肯定不如 maxWidth。

@hustcc hustcc merged commit 7b50766 into v5 May 30, 2023
3 checks passed
@hustcc hustcc deleted the feat-interval-maxWidth branch May 30, 2023 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

【特性】柱形图设置 maxWidth,minWidth
2 participants