本文介绍了如何用nvd3绘制对数线图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一种方法用nvd3绘制对数线图
Is there a way to draw logarithmic line charts with nvd3
推荐答案
我不是一个nvd3 / d3的专家,我已经为 nv.models.lineChart
:
I'm not a nvd3/d3 expert, but I've made something which seems to work like this for the nv.models.lineChart
:
chart.yScale(d3.scale.log());
chart.yAxis.tickValues([1,10,100,1000,10000,1000000]);
chart.forceY([1,1000000]);
注意:
-
yScale
函数在模型之间可能略有不同(chart.lines.yScale
&cart.lines2.yScale
在nv.models.lineWithFocusChart
例如) - t似乎适用于所有型号
-
自版本 D3.js支持,使用示例
- The
yScale
function may be slightly different between models (chart.lines.yScale
&cart.lines2.yScale
onnv.models.lineWithFocusChart
for example) - This doesn't seem to work with all models
- As of version 3.1.0 D3.js supports arbitrary logarithm base, usage example http://bl.ocks.org/mbostock/7621155
这篇关于如何用nvd3绘制对数线图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!