Search code examples
d3.jsdonut-chart

prevent d3 donut chart from sorting automatically


Is there a way to prevent a donut chart from sorting values automatically? I don't see anywhere where I have specified that values should be sorted, yet, they are arranged in a descending order in clockwise fashion. Any suggestions would be great.

http://jsbin.com/cufuhukuki/edit?js,output


Solution

  • Use sort(null) in your pie layout:

    donut = d3.layout.pie().sort(null);
    

    Here is your JS Bin: http://jsbin.com/xoqapibuvo/1/edit