D3.js nvd3.js - Get the min / max values ​​of the y axis

I am using the NVD3 lineChart model.

I need to force the min and max y values ​​to be relative to the actual ones, for example:

chart.lines.forceY ([min / 1.1, not more than 1.1 *]);

How to get current min / max y-axis values?

+4
source share
2 answers

You can get the current domain through chart.yAxis.scale().domain().

+4
source

If you have already set the y axis domain as follows:

var yAxis = d3.svg.axis().scale(y)
    .orient("left").ticks(5);

y.domain([0, d3.max(yourData)]);

You can access the values ​​through y. y[0]- minimum y[1]- max.

+1
source

All Articles