如何用nvd3绘制对数线图 [英] How to draw logarithmic line charts with nvd3

查看:144
本文介绍了如何用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]);

注意:


  1. yScale 函数在模型之间可能略有不同( chart.lines.yScale & cart.lines2.yScale nv.models.lineWithFocusChart 例如)

  2. t似乎适用于所有型号

  3. 仅限D3支持base10目前
    自版本 3.1.0 D3.js支持任意对数基数,使用示例 http://bl.ocks.org/mbostock/7621155

  1. The yScale function may be slightly different between models (chart.lines.yScale & cart.lines2.yScale on nv.models.lineWithFocusChart for example)
  2. This doesn't seem to work with all models
  3. D3 only supports base10 currently As of version 3.1.0 D3.js supports arbitrary logarithm base, usage example http://bl.ocks.org/mbostock/7621155

这篇关于如何用nvd3绘制对数线图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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