如何在 nvd3 中禁用图例或限制其大小 [英] How to disable legend in nvd3 or limit it's size
问题描述
我正在使用 nvd3 并有一些图表,其中的图例很大.例如.具有 15 个组的分散/气泡,并且组名很长.图例太大了,几乎没有图表本身的空间.
I'm using nvd3 and have a few charts where the legend is much to large. E.g. a scatter/bubble with 15 groups and the group names are long. The legend is so large that it leaves almost no room for the chart itself.
有没有办法删除图例或切换图例或限制它占用的高度/宽度?任何例子都会很棒.
Is there a way to remove the legend or toggle the legend or limit the height/width it is taking up? Any example would be great.
另外,有没有办法让气泡显示描述性字符串?现在,当您站在气泡顶部时,它会突出显示 x/y 坐标.我还希望它显示气泡名称.
Also, is there a way to have the bubble show a descriptive string? Right now when you stand on top of a bubble it highlights the x/y coordinates. I also want it to show the bubble name.
例如,我的每个气泡代表一个国家(有名字),x 是 GDP,y 是债务.该组是一个分类/不是名称.
For example, each of my bubbles represents a country (which has a name), the x is GDP and the y is debt. The group is a classification/not name.
推荐答案
.showLegend(false)
会帮助你.这是一个例子 -
.showLegend(false)
will help you. Here is an example -
chart = nv.models.multiBarHorizontalChart().x(function(d) {
return d.x
}).y(function(d) {
return d.y
}).showLegend(false);
这篇关于如何在 nvd3 中禁用图例或限制其大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!