是否可以显示每个传说与图表中的每个栏对齐。
我使用Chart.js制作了水平条形图。在默认设置中,所有传说都像
它们之间没有差距。我想显示每个传说与每个栏都像这样
是否可以在Chart.js中的每个栏对齐传奇和中心?
我正在使用Chart.js(v.3.7)
I made a horizontal bar chart using Chart.js. In default setting all the legends are shown all together like this
there is no gap among them. I want to show each legend aligned with each bar like this
I tried so many solutions but none of them worked. Is it possible to show legends right and center aligned with each bar in chart.js?
I am using Chart.js (v.3.7)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在寻找的行为可以通过在传奇标签配置并试图找到正确的值。
这看起来可能是这样的:
您通常不会为此使用传奇,而是直接按照下面的链接进行标记。
请查看文档: httpps:htttps:///www.chartjs。 org/docs/最新/轴/笛卡尔/#tick-configuration
它提供了一个有关如何使用类似轴标签的示例:
The behavior you are looking for can possibly be achieved by using the padding option in the Legend Label Configuration and trying to find the correct value.
This could look something like this:
You would usually not use a legend for this but instead label the axis directly as described in the link below.
Have a look at the documentation: https://www.chartjs.org/docs/latest/axes/cartesian/#tick-configuration
It provides an example on how to use axis labels like that: