(D3.js) How to invert the X-axis? From 0...10 to 10...0

2.5k views Asked by At

I need to invert the X-axis to have it begin from the biggest value and to degrade to lowest. For example beginning from 2015 and ending 1985.

Is it possible to just sort the original data json/array in php? Or will it be sorted back to lowest to highest?

1

There are 1 answers

4
Gabriel On

Maybe this will help,reversed Y-axis D3. You can use this code to invert your data. Change .range([0, h]); to .range([h, 0]);. This sample will help to sort data sort.