You're using d3.max
incorrectly. The first argument has to be an array. The second (optional) argument is a function to extract the relevant value from each element in the array.
The call d3.max(hardcover_fiction.weeks)
returns 0 because hardcover_fiction.weeks
doesn't exist. You need
d3.max(hardcover_fiction, function(d){return d.weeks;})
The rest of your code snippet should work as expected.