cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              
<body>
<div id="footer" class="container justify-content-center text-center">
  Written and Coded By <a href="http://yingjiehu.com" target="_blank">Yingjie Hu</a> with <span style="color:red"><i class="fas fa-heart"></i></span><br>
  View <a href="https://github.com/huyingjie/theLocalWeather" target="_blank">source code</a> at GitHub and latest <a href="http://localweather.yingjiehu.com/" target="_blank">updated website</a>
</div>
</body>

</html>
            
          
!
            
              body {
  background: rgb(63, 169, 255);
}

#barplot {
  background-color: white;
}
#footer {
  position: absolute;
  bottom: 20px;
  font-size: 14px;
}

            
          
!
            
                  const w = 1000;
    const h = 500;
    d3.json("https://raw.githubusercontent.com/freeCodeCamp/ProjectReferenceData/master/GDP-data.json",

    (dataset) => {
      const DATE = dataset["data"].map((d)=>d[0]);
      const VALUE = dataset["data"].map((d)=>d[1]);
      // console.log(DATE);
      // console.log(VALUE);
      const svg = d3.select("body")
      .append("svg")
      .attr("width", w)
      .attr("height", h);

      svg.selectAll("rect")
      .data(VALUE)
      .enter()
      .append("rect")
      .attr("x", (d, i) => i*5)
      .attr("y", (d, i) => h - d/100)
      .attr("width", 4)
      .attr("height", (d,i) => d/100)
    }


  );
            
          
!
999px
Loading ..................

Console