D3.js 添加第二个Y轴

D3.js 添加第二个Y轴,d3.js,nvd3.js,D3.js,Nvd3.js,有没有一种简单的方法可以将第二个Y轴添加到图表模型中?我看到图表具有此功能(通过y1Axisy2Axis和forceY),但是否有简单的方法将其添加到其他型号?我想将其用于线形图或散点模型。相同的X轴,不同的Y值需要双Y轴。你可以试试这个: plot(x,y1......,axes=F) axis(2,....) # build the left Y axis par(new=T) # means that the next chart will be draw on the picture y

有没有一种简单的方法可以将第二个Y轴添加到图表模型中?我看到图表具有此功能(通过
y1Axis
y2Axis
forceY
),但是否有简单的方法将其添加到其他型号?我想将其用于线形图或散点模型。

相同的X轴,不同的Y值需要双Y轴。你可以试试这个:

plot(x,y1......,axes=F)
axis(2,....) # build the left Y axis
par(new=T) # means that the next chart will be draw on the picture you draw above
plot(x,y2......,axes=F)
axis(4,....) # build the right Y axis