I am currently using the multiChart model and I have two different y Axes. I would like to like to change both of the axes so that they start at 0 because currently they start at the smallest y data point.
I have tried doing the following
chart.yAxis1
tickFormat(d3.format(',.f'))
.domain([0,max_y]);
but that doesnt seem to work
and
.forceY ([0, max_y])
it tells me that there is no forceY function
Any ideas?
You can force min and max values in NVD3 for line or bar charts, try as below:
chart.bars.forceY([0]);
chart.lines.forceY([0,100]);
.domain([0, max_y])
should be used on a scale object, not an axis object.
So:
var yScale = d3.scale.linear().domain([0,max_y])
var yAxis = d3.svg.axis().scale(yScale)
This should work; if not, you should post what you have as a jsfiddle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With