NVD3(D3 JS)如何删除y2轴 [英] NVD3 (D3 JS) how to remove y2 axis

查看:248
本文介绍了NVD3(D3 JS)如何删除y2轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用以下示例,它是一个线和条形图的组合。

I'm trying to use the following example which is a line and bar chart combined.

NVD3 Line&条形图组合

我想要的问题是,我想让折线图和条形图都使用y1轴的相同数字,但我可以'找到如何摆脱y2轴并执行此操作。

The problem I have is that I want the line chart and bar chart to both use the same figures from y1 axis, but I can't find out how to get rid of the y2 axis and do this.

如果有人可以指向正确的方向,这将是一个很大的帮助。

If someone could point me in the right direction it'd be a great help.

提前感谢。

编辑:

的我遇到的问题。我只是使用NVD3的下载示例,并在返回图表之前添加了Lars代码; 行。

A JSFiddle of the problem I'm experiencing. I'm just using the example from NVD3's download and have added in Lars' code just before the return chart; line.

JSFiddle

推荐答案

没有选项可禁用第二个y轴。您可以做的是将其设置为与y1轴具有相同的比例,然后在创建图形后删除它。

There's no option to disable the second y axis. What you can do is set it up to have the same scale as the y1 axis and then remove it after creating the graph, i.e.

d3.select('.nv-y2.nv-axis').remove();

这会留下一些空的空间,轴在以前是,但至少它会创建只有一个y轴的印象。

This will leave some empty space where the axis used to be, but at least it'll create the impression that there's only one y axis.

这篇关于NVD3(D3 JS)如何删除y2轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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