title: D3.js Sequence Sunburst, change data on click
body: <p>I'm trying to change the data of the Sequence Sunburst found here:
  <a href="http://bl.ocks.org/kerryrodden/7090426" rel="nofollow">http://bl.ocks.org/kerryrodden/7090426</a></p>
  
  <p>I want it to change to a new dataset (csv, or json) when I click a button.</p>
  
  <p>I tried reading a new csv, and calling <code>createVisualization(json);</code>:</p>
  
  <pre><code>$('.toggle-data').click( function() {
    d3.text("../csv/new-data.csv", function(text) {
      var csv = d3.csv.parseRows(text);
      var json = buildHierarchy(csv);
      createVisualization(json);
    });
  });
  </code></pre>
  
  <p>I also tried calling <code>createVisualization(json);</code>directly with an updated json.</p>
  
  <p>In both ways I get this error: <code>Uncaught TypeError: Cannot read property '__data__' of null</code>
  Which refers to this line of code: <code>totalSize = path.node().__data__.value;</code></p>
  
  <p>I also tried removing the old svg before creating the new one, but that didn't change anything.</p>
  
  <p><strong>Question:</strong> How can I change the underlaying data of that sunburst (ideally animating from one dataset to another)?</p>
  
  <p>I didn't manage to make a working <strong>fiddle</strong>, so here is one from another thread (all the code is in the above link though): <a href="http://jsfiddle.net/zbZ3S/" rel="nofollow">http://jsfiddle.net/zbZ3S/</a> (different data - using json, but should be the same code as the link above)</p>