Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

在G2 5.1 中如何获取 axis 的所有值,也就是axis的label的集合 #5628

Closed
PDieE opened this issue Oct 12, 2023 · 3 comments
Closed

Comments

@PDieE
Copy link

PDieE commented Oct 12, 2023

  • G2 Version: 5.1
  • Platform:
  • Mini Showcase(like screenshots):
  • CodePen Link:

我想在图表中绘制一些和axis的label有关的自定义图形,但是我找不到如何获取相关数据的方法

@pearmini
Copy link
Member

是想获取 label 的文本数据?

@PDieE
Copy link
Author

PDieE commented Oct 12, 2023

是想获取 label 的文本数据?

最终目的是想获取axis的label的文本数据集合

@pearmini
Copy link
Member

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

chart.render(() => {
  const { canvas } = chart.getContext();
  const document = canvas.document;
  const labels = document.getElementsByClassName(LABEL_CLASS_NAME);
  // ...
});

@antvis antvis locked and limited conversation to collaborators Oct 12, 2023
@pearmini pearmini converted this issue into discussion #5629 Oct 12, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants