Search code examples
javascriptd3.jssunburst-diagramtabletop.js

Zoomable sunburst visualization comes out messed up


I am reading a spreadsheet using sheetsee.js (and tabletop.js) and trying to create a zoomable sunburst with labels visualization. However, it is only creating one level and the text is rotated either +90 or -90. The URL to my html page is http://www.wyzpubs.com/dataviz/sheetsee/dita_users_sb.html

Can someone tell me what could be causing this? I think the way I am creating the JSON with size information is OK and it is exactly like in metmajer's zoomable sunburst with labels.

Thanks, Jayaram


Solution

  • The bug is here in sheetsee.sunburst.js

    var partition = d3.layout.partition()
            .value(function(d) { return d.size; });
    

    Your data has nothing like size(in the json) thus everything gets collapsed.

    It should have been some value to decide the arc length size I did something like this(but you can change it to some biz logic of yours):

    var partition = d3.layout.partition()
            .value(function(d) { return d.parent.children.length; });
    

    Working code here

    Hope this helps!