I\'m using d3.js charts in one of my applications. Here they are in this image See Charts
For Y axis on Money chart (See in the Image), I want maximum value rounded
I use nvd3 and for me this worked instead:
nv.models.discreteBarChart().yDomain([0,400])
I could'nt get it to work with yScale.domain
You need to modify the domain of the Y-axis scale. Usually it is derived from the maximum value of the data with a statement like the following:
yScale.domain([0, d3.max(data, function (d) { return d.v; }) ]);
In your case, you should modify it to be more like this instead:
yScale.domain([0, 400]);
Alternatively, if you want to set the maximum value from the data or a minimum static value, you could do something like the following:
yScale.domain([0, d3.max(data, function (d) { return d.v > 400 ? d.v : 400; }) ]);
A full example jsfiddle is here.
That's how to do it with D3.js, I'm not familiar with the venerable nvd3.js lib, so I'm not sure how to access the scale, but i'll take a look and see if I can find it.
Force Y
List of numbers to Force into the Y scale (ie. 0, or a max / min, etc.). The numbers tell the d3.js the values to use in the scale, rather than d3.js determining the values.
Datatype: Array of Numbers (i.e. [0, 50]
http://cmaurer.github.io/angularjs-nvd3-directives/line.chart.html