We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
5.x版本条形图y轴是否可以显示双刻度,例如左侧显示刻度值,右侧展示刻度百分比?
无复现
No response
🆕 5.x
The text was updated successfully, but these errors were encountered:
在 G2 5.x 版本中,您可以通过自定义 y 轴的刻度来实现显示双刻度的效果,例如左侧显示刻度值,右侧展示刻度百分比。虽然官方文档中没有直接提到双刻度的实现,但您可以通过以下方法进行自定义:
自定义刻度:您可以使用 scale 方法来自定义 y 轴的刻度。例如,您可以定义一个自定义的 tickMethod 来生成所需的刻度值。
scale
tickMethod
chart .interval() // ... .scale('y', { type: 'linear', domain: [0, 100], tickMethod: () => [0, 20, 40, 60, 80, 100] // 自定义刻度 });
使用多轴:如果需要在同一图表中显示不同的刻度单位(如值和百分比),可以考虑使用多轴图表。通过在图表中添加多个 y 轴来实现不同的刻度显示。
具体实现可能需要结合自定义的刻度和多轴配置来达到您想要的效果。
如果您需要更详细的实现步骤或示例代码,请告诉我,我会尽力帮助您。
Sorry, something went wrong.
可以参考官网双轴图的案例代码。
No branches or pull requests
Describe the bug / 问题描述
5.x版本条形图y轴是否可以显示双刻度,例如左侧显示刻度值,右侧展示刻度百分比?
Reproduction link / 复现链接
无复现
Steps to Reproduce the Bug or Issue / 重现步骤
No response
Version / 版本
🆕 5.x
OS / 操作系统
Browser / 浏览器
The text was updated successfully, but these errors were encountered: