spiermar / burn

burn :fire: is a CLI tool to convert performance profiles to hierarchical data structures that can be visualized as flame graphs
Apache License 2.0
84 stars 8 forks source link

Sample in README was broken by d3.fetch moving from callbacks to Promises #13

Closed mhansen closed 2 years ago

mhansen commented 2 years ago

If I run the example in the README:

<head>
  <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/d3-flame-graph@4.0.7/dist/d3-flamegraph.css">
</head>
<body>
  <div id="chart"></div>
  <script type="text/javascript" src="https://d3js.org/d3.v7.js"></script>
  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/d3-flame-graph@4.0.7/dist/d3-flamegraph.min.js"></script>
  <script type="text/javascript">
  var chart = flamegraph()
    .width(960);

  d3.json("data.json", function(error, data) {
    if (error) return console.warn(error);
    d3.select("#chart")
      .datum(data)
      .call(chart);
  });
  </script>
</body>

The callback isn't called, even though loading data.json succeeded with HTTP 200. This is because d3 moved from callbacks to returning a promise in d3 v5.

mhansen commented 2 years ago

Ah, sorry, I filed this on the wrong repo. Too many tabs open. I'll file on https://github.com/spiermar/d3-flame-graph

mhansen commented 2 years ago

https://github.com/spiermar/d3-flame-graph/issues/197