Skip to main content
100%

making a bar chart

✓ Published0🌍 Public
Gginnyching
Last edited Oct 1, 2022
Created on Oct 1, 2022

This example renders a blank SVG bar chart canvas sized 960 by 500 pixels. It demonstrates how to load D3 v7 from UNPKG, import the `select` function from the `d3` module, and parse SVG dimensions using both `parseFloat` and the unary `+` operator. The code selects the existing SVG element and converts its height and width attributes from strings to numbers for later use. The example shows the foundational setup for building a chart, with no actual bars or data plotted yet.

AI-generated description

An example showing the capabilities of VizHub:

  • Loads D3 via UNPKG.
  • Demonstrates use of import from "d3".
  • Demonstrates use of import from local ES6 modules.
MIT Licensed

Similar vizzes