d3.js & nvd3.js — How to set y-axis range

后端 未结 6 1540
闹比i
闹比i 2020-12-05 04:00

I\'m trying to set the y-axis range of the chart from 1-100.

Consulted the API documentation and found a possible solution with axis.tickValues as seen here https://

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-05 04:42

    Found a solution.

    Appending .forceY([0,100]) to the instantiation of the chart forces the axis to take on the range specified in the array.

    From the example here http://nvd3.org/livecode/#codemirrorNav

    Appending .forceY([0,100]) to the chart variable works.

提交回复
热议问题