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

🐛 [BUG] g2plot 2.x 对称条形图 图例位置和值标签位置 配置 #2816

Closed
rabbit-tian opened this issue Aug 24, 2021 · 2 comments · Fixed by antvis/G2#3682 or #2921
Closed
Assignees
Labels
Bug Something isn't working

Comments

@rabbit-tian
Copy link

rabbit-tian commented Aug 24, 2021

  1. 值标签希望支持,位置position配置:左中右,目前左中右配置错位,见图1

image

  1. 图例位置支持配置,目前 controller.getComponents() 是个空值,没有返回信息,见图2

image

  1. 复现地址:https://codesandbox.io/s/patient-feather-kzqrc?file=/index.ts:1105-1131

  2. 麻烦老师看下,轴到轴标签底部的距离能否获取
    image

  • G2Plot Version: 2.3.31
  • Platform: g2plot 2.x
@rabbit-tian rabbit-tian added the Bug Something isn't working label Aug 24, 2021
@rabbit-tian
Copy link
Author

@visiky 麻烦老师看下哈~

@Aarebecca
Copy link
Contributor

  1. 该特性正在开发过程中
  2. 当前在分面图以及对成图等含有子图的视图中,暂不支持plot.chart.getController()方法,可以通过以下方法在视图渲染完成之后获得子图controller:
plot.on('afterrender', ({view}) => {
  // views[i] 中 i 为子图索引
  const axisController = view.views[0].getController('axis')
})
  1. 暂未提供相关API,如果一定要获取,可以尝试:
const texts = plot.chart.getController('axis').axisContainer.getChildren()[0].getChildren()[1].getChildren()

通过上述路径能过拿到x轴中每个刻度值的文本对象,然后通过:texts[i].getBBox() 方法获得第i个文本对象的宽高及坐标信息

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
2 participants