bhylu.com

Advertisements

JS D3.js

D3 works with data and the DOM. Load the library locally and start with a small selection before adding scales and interactions.

Where to run this

Use a local browser project for this example. It needs browser permissions, additional files, a server endpoint, or a library as described below. The restricted playground cannot provide those dependencies.

A practical example

JavaScript

// HTML: <ul id="bookings"></ul>
// Load D3 in your local project first.
d3.select("#bookings")
  .selectAll("li")
  .data(["Repair: 8", "Wood: 5"])
  .join("li")
  .text(value => value);

What happens

D3 joins two data values to two list items.