javascript - NVD3 max value on inverted yAxis -


i'm trying simple linechart inverted y-axis , i'm sure problem easy solve somehow can't make work.

my y-values ranks , "1" best should on top of chart.

chart.ydomain([10,1])  

does job ... in future might have data outside of domain , try maximum y-value directly data replace manually set "10".

i played around with

d3.max(data, function(d){ return d.rank; } ) 

and looked @ why domain not using d3.max(data) in d3? whatever try, can't make work.

maybe can me out? it's first time i'm working nvd3 , i'm not familiar it.

my fiddle here: http://jsfiddle.net/marei/w0385jj3/

thank much!

you can use d3.merge .map

d3.max(d3.merge(data.map(function(d){return d.values})), function(d) {return d.rank}); 

updated fiddle.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -