Data Visualization with D3: Add Inline Styling to Elements

D3 lets you add inline CSS styles on dynamic elements with the style() method.

The style() method takes a comma-separated key-value pair as an argument. Here's an example to set the selection's text color to blue:"color","blue");

Add the style() method to the code in the editor to make all the displayed text have a font-family of verdana.

    const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];"body").selectAll("h2")
      .text((d) => (d + " USD"))
      // Add your code below this line

      // Add your code above this line

results matching ""

    No results matching ""