d3.js - change Axis domain/range doesn't work in nvds -


i'm trying nvd3 example @ http://nvd3.org/livecode/index.html#codemirrornav please click on plot 2 "scatter/bubble chart". original code javascript like:

nv.addgraph(function() {   var chart = nv.models.scatterchart()             .showdistx(true)             .showdisty(true)             .color(d3.scale.category10().range());    chart.xaxis.tickformat(d3.format('.02f'));   chart.yaxis.tickformat(d3.format('.02f'));    d3.select('#chart svg')     .datum(data(4,40))     .transition().duration(500)     .call(chart);  nv.utils.windowresize(chart.update);  return chart; }); 

i tried change xaxis range/scale/domain see if has anything. somehow doesn't work.

what did add

var xscale = d3.scale.linear().domain([0,1]).range([1,4]); chart.xaxis.scale(xscale); chart.xaxis.tickvalues([1,2,3]); 

below yaxis line in original plot. can see tickvalues work expected. somehow both domain , range doesn't work expected.

i see xaxis start different value 1 or 0. please help.

try

chart.forcex([minvalue,maxvalue]) 

hope helps.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -