title: How to import submodules from d3 to easily create legend?
body: <p>I'm relatively new to JavaScript and D3 so please keep that in mind. I've created a visualization to show the visit frequency to particular locations in a warehouse and would like to add a legend using a continuous color scale. </p>
  
  <p><a href="https://i.stack.imgur.com/j7DpG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j7DpG.png" alt="enter image description here"></a></p>
  
  <p>I've looked at several blocks and could come up with something tangential, however I came across <a href="https://observablehq.com/@mumairofficial/color-legend" rel="nofollow noreferrer">this</a> webpage and would like to use the legend function. Naively, I tried adding </p>
  
  <pre><code>import {legend} from "@d3/color-legend"
  </code></pre>
  
  <p>which failed as expected. I am not sure what to do in order to make this import work. I've downloaded the latest d3.zip file and have tried the following sources without any success.</p>
  
  <pre><code>&lt;script type="text/javascript" src="https://d3js.org/d3.v5.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="d3.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Any guidance would be greatly appreciated.</p>