在 D3js 多线图表上的 x 标题上方添加空格
我正在尝试在D3J多行图上添加Xcaption和X轴标签之间的空间,但无法。另外,我如何摆脱最后的X标签(5点以后的标签)。
const XCaption = svg.append('g')
.attr('class', 'x axis')
.attr('transform', `translate(0, ${height - margin})`)
.call(xAxis)
.append('text')
.attr('x', (width/2) - 24)
.attr('y', 25)
.attr('transform', 'rotate(0)')
.attr('fill', '#437495')
.attr('font-size', '16px');
I am trying to add space between xCaption and x-axis labels on D3js multiline chart but not able to. Also, how can I get rid of the last x-label (the one after 5).
const XCaption = svg.append('g')
.attr('class', 'x axis')
.attr('transform', `translate(0, ${height - margin})`)
.call(xAxis)
.append('text')
.attr('x', (width/2) - 24)
.attr('y', 25)
.attr('transform', 'rotate(0)')
.attr('fill', '#437495')
.attr('font-size', '16px');
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过更改 y 来向下滑动 x 标题:
末尾的那些小刻度通常是轴域的一部分。使用CSS:
You can slide down your x caption by changing y:
Those little ticks at the end are usually part of the axis domain. Use the css: