2021年4月6日星期二

Unable to determine correct version D3 for sample code I found

I'm experimenting with the example code at: http://jsfiddle.net/7HZcR/3/ I get an error that there is no such function as force. I tried d3.force() and d3.forceSimulation().
I looked for the error message and it seems like this is due to a version change. I don't see in jsFiddle where the script file includes the D3 code, so I don't know what version it's using. Is there a way to determine which version of D3 one should include?

<!DOCTYPE html>  <head>      <meta http-equiv="content-type" content="text/html; charset=UTF-8">      <title>Test of http://jsfiddle.net/7HZcR/3/ </title>      <style>          cut-n-paste of css code      </style>      <script src="https://d3js.org/d3.v6.min.js"></script>      <script>          cut-n-paste of js code          blah blah      var force = d3.layout.force()          .nodes(d3.values(nodes))          .links(links)          .size([w, h])          .linkDistance(60)          .charge(-300)          .on("tick", tick)          .start();          blah      </script>  </head>  <html>      <body>          <div id="chart"></div>      </body>  </html>  
https://stackoverflow.com/questions/66973128/unable-to-determine-correct-version-d3-for-sample-code-i-found April 07, 2021 at 12:58AM

没有评论:

发表评论