Saturday, June 1, 2024
 Popular · Latest · Hot · Upcoming
189
rated 0 times [  196] [ 7]  / answers: 1 / hits: 21522  / 11 Years ago, wed, june 12, 2013, 12:00:00

I am currently using NVD3 to make a few line charts. I am wondering if it is possible to make the y axis ticks to always start from 0. Currently it always starts from the lowest y value. I have tried using tickValues but I do not want to change the other values. I have also tried to add a data point with a value of 0, but this seems like a workaround and it affects the way the graph looks. Any ideas?


More From » d3.js

 Answers
34

You don't need to add a dummy data point, all you need is adjust the input domain of the scale, e.g. something like



chart.yAxis.scale().domain([0, maxValue]);

[#77662] Tuesday, June 11, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
makaylahh

Total Points: 128
Total Questions: 106
Total Answers: 97

Location: Tanzania
Member since Wed, Feb 24, 2021
3 Years ago
;