Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
108
rated 0 times [  113] [ 5]  / answers: 1 / hits: 67133  / 12 Years ago, wed, august 1, 2012, 12:00: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://github.com/mbostock/d3/wiki/SVG-Axes#wiki-tickValues



However, using the option does not work. Reading further down on the documentation page linked above under axis.tickSize, the following line was spotted




The end ticks are determined by the associated scale's domain extent,
and are part of the generated path domain rather than a tick line




So I take it setting the min and max of the range can't be done through the Axis option.



Any ideas on where I can specify the range?


More From » d3.js

 Answers
2

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.


[#83914] Tuesday, July 31, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jaylynkarinam

Total Points: 740
Total Questions: 103
Total Answers: 103

Location: Liechtenstein
Member since Wed, Dec 8, 2021
3 Years ago
jaylynkarinam questions
Tue, Jul 23, 19, 00:00, 5 Years ago
Fri, Jul 5, 19, 00:00, 5 Years ago
Fri, Apr 12, 19, 00:00, 5 Years ago
Wed, Oct 31, 18, 00:00, 6 Years ago
;