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

x 轴 autoEllipsis: true 处理不正确 #3818

Closed
hustcc opened this issue Feb 28, 2022 · 1 comment
Closed

x 轴 autoEllipsis: true 处理不正确 #3818

hustcc opened this issue Feb 28, 2022 · 1 comment
Assignees

Comments

@hustcc
Copy link
Member

hustcc commented Feb 28, 2022

  • G2 Version: 4.1.x
  • Platform: all
  • Mini Showcase(like screenshots):
  • CodePen Link:

以下代码,x 轴标签省略不正确:

image

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

const data = [
  { year: "1951 年", sales: 38 },
  { year: "1952 年年年", sales: 52 },
  { year: "1956 年年", sales: 61 },
  { year: "1957 年年年年", sales: 45 },
  { year: "1958 年年年年年年", sales: 48 },
  { year: "1959 年", sales: 38 },
  { year: "1960 年", sales: 38 },
  { year: "1962 年", sales: 38 },
];

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

chart.axis('year', {
  label: {
    autoHide: false,
    autoEllipsis: true,
  }
});
chart.interval().position('year*sales');

chart.render();
@visiky visiky self-assigned this Feb 28, 2022
@visiky
Copy link
Member

visiky commented Feb 28, 2022

需要添加这个 verticalLimitLength 配置,才能使用

chart.axis('year', {
  label: {
    autoHide: false,
    autoEllipsis: true,
  },
  verticalLimitLength: 60
});

@visiky visiky added the FAQ label Mar 8, 2022
@visiky visiky closed this as completed Mar 8, 2022
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

No branches or pull requests

2 participants