I have drawn my axes in d3 using the d3.extent method to determine the max and min values for the axis.
However, by default, d3 draws the y axis upside down (d3 bar chart is upside down) and I need to invert it.
How to I tell the extent method to invert the results?
You can use d3.extent function in combination with reverse:
var yScale = d3.time.scale()
.domain(d3.extent(data.History, function (d) { return d.ArrivalTime; }).reverse())
.range([margin.top, chartHeight - margin.top * 2]);
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