简体   繁体   English

如何阻止轴标签在图表 JS 中被切断?

[英]How to stop axis label from being cut off in chart JS?

How do I stop the chart from cutting off the axis label words?如何阻止图表切断轴标签词? This question is similar: " How do I prevent the scale labels from being cut off in chartjs? " But only addresses the labels on the tick marks.这个问题是类似的:“ 如何防止在 chartjs 中比例标签被切断? ”但只解决刻度线上的标签。

The axis label should say "mental health continuum".轴标签应为“心理健康连续体”。 But the m is cut off.但是m被切断了。

图表截断

You can fix that by setting the layout padding on the chart.您可以通过在图表上设置布局填充来解决这个问题。

options: {
  layout: {
    padding: {
      top: 20
    }
  }
}

Here is the reference http://www.chartjs.org/docs/latest/configuration/layout.html这是参考http://www.chartjs.org/docs/latest/configuration/layout.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM