如何防止图表中的刻度标签被切断? [英] How do I prevent the scale labels from being cut off in chartjs?

查看:17
本文介绍了如何防止图表中的刻度标签被切断?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 chartjs 时遇到问题,其中刻度标签以下列方式被切断":

I am having a problem with chartjs where the scale labels are being "cut off" in the following way:

[1]

是否可以设置边距?我在 chartjs 文档中没有看到任何关于此的内容,这些似乎包含在 chartjs 画布元素中(意思是:未被另一个 div 覆盖).

Is there a margin that can be set? I don't see anything in the chartjs documentation about this, and these seem to be contained within the chartjs canvas element (meaning: not covered by another div).

推荐答案

value 之前添加带有空格的比例标签选项.允许使用 2 个或更多空格.

Add scale label option with whitespace before value. 2 or more whitespaces is allowed.

scaleLabel: "<%= ' ' + value%>"

这篇关于如何防止图表中的刻度标签被切断?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆