javascript - how i can exchange y1 axis with y2 axis in nvd3.js? -
i'm newbie in javascript using nvd3.js, want visualize data-data using nvd3.js. have tried nvd3.js , part of code :
var chart; nv.addgraph(function() { chart = nv.models.lineplusbarchart() .margin({top: 30, right: 60, bottom: 50, left: 70}) .x(function(d,i) { return }) .color(d3.scale.category10().range()); chart.xaxis .tickformat(function(d) { var dx = testdata[0].values[d] && testdata[0].values[d].x || 0; return dx ? d3.time.format('%x')(new date(dx)) : ''; }) .showmaxmin(false) .axislabel("x-axis label"); chart.y1axis .tickformat(d3.format(',f')) .axislabel("y1axis label"); chart.y2axis .tickformat(function(d) { return '$' + d3.format(',.2f')(d) }) .axislabel("y2axis label"); chart.bars.forcey([0]).paddata(false); //chart.lines.forcey([0]); d3.select('#chart1 svg') .datum(testdata) .transition().duration(500).call(chart); nv.utils.windowresize(chart.update); chart.dispatch.on('statechange', function(e) { nv.log('new state:', json.stringify(e)); }); return chart;
full code in here : http://jsfiddle.net/8zvlj/2/
i want exchange y1 axis in left side right side , y2 axis in right side left side, have tried, still not work, how can that?
thanks
Comments
Post a Comment