Search code examples
graphnvd3.js

set maximum x and y axis range NVD3


I am trying to plot the line graph using NVD3. But the issue I am facing is that the maximum values of x and y axis get adjusted automatically depending on the data provided. But I don't want this default behavior, I want to preset the maximum values for X and Y axis. Is there an option to do so in NVD3?

Tried this domain approach but didn't work


Solution

  • You could try chart.forceY([minValue, maxValue]).

    NVD3 is built on D3 so if you are to look deep, it's best to look into the D3 Api.