如何更改图表中的X轴标签位置。 X轴标签应在图表内而不是外部显示
我使用的是Angular 13和Chart.js 3.7.1。我想让X轴标签应在栏旁边和图表内移动,而不是在图表外显示。
I am using Angular 13 and chart.js 3.7.1. I would like to have the x-axis labels should be moved beside the bar and inside the chart instead of displayed outside of the chart.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可以通过 chartjs-plugin-datalabels 来完成。它提供了许多用于定位标签的选项。
请看一下下面的可运行代码,看看它是如何完成的。
This can be done with chartjs-plugin-datalabels. It offers many options for positioning the labels.
Please take a look at below runnable code and see how it could be done.