简体   繁体   English

在 DC.js 图表上移动 x 轴标签

[英]Move x-axis label on DC.js chart

Wondering how I get the x-axis label to not overlap with the tick marks (see below)想知道如何让 x 轴标签不与刻度线重叠(见下文)

Any help much appreciated!非常感谢任何帮助!

重叠 x 标签

It's counterintuitive, but you need to set the margins to allow space for the tick labels and Y axis label.这是违反直觉的,但您需要设置边距以允许刻度标签和 Y 轴标签的空间。

dc.js does not automatically lay out elements that rely on text size, because it is complicated and expensive to do so. dc.js 不会自动布局依赖于文本大小的元素,因为这样做既复杂又昂贵。

Instead it requires the user to set margins that leave room.相反,它要求用户设置留出空间的边距。 The margins are used to shrink and offset the chart area.边距用于缩小和偏移图表区域。

The default margins are {top: 10, right: 50, bottom: 30, left: 30} ;默认边距为{top: 10, right: 50, bottom: 30, left: 30} ; these settings are just a guess.这些设置只是一个猜测。 You might try你可以试试

chart.margins({top: 10, right: 50, bottom: 30, left: 60})

and then continue to tweak until it looks right.然后继续调整直到看起来正确。

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

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