Is there a way to draw logarithmic line charts with nvd3
Asked
Active
Viewed 3,539 times
1 Answers
10
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]);
Notes:
- 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
D3 only supports base10 currentlyAs of version 3.1.0 D3.js supports arbitrary logarithm base, usage example http://bl.ocks.org/mbostock/7621155

Martin
- 2,135
- 8
- 39
- 42

throwaway112358
- 116
- 1
- 2