NVD3水平条形图标签太长 [英] NVD3 Horizontal Bar Chart labels too long

查看:100
本文介绍了NVD3水平条形图标签太长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据带有长标签,即:

I have data that has long labels, i.e:

values:
  [      
    { x : "This is a really looong label", y : 40 },
    { x : "Short label", y : 30 } 
  ]

仅显示一小部分文字,其余部分被隐藏

and only a small portion of the text is shown and the rest is hidden

这里是 jsfiddle 来演示此问题.

理想情况下,我想为标签设置自定义宽度和/或使它们在溢出时能够使用多行.

Ideally I would like to set a custom width for the labels and/or make them able to use multiple lines if they overflow.

这可能吗?

推荐答案

为什么不仅仅增加页边距?

Why not just add margins?

var chart = nv.models.multiBarHorizontalChart()
               .margin({top: 30, right: 20, bottom: 50, left: 175});

这篇关于NVD3水平条形图标签太长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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