本文介绍了如何禁用nvd3中的图例或限制其大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用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中的图例或限制其大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 04:27