Skip to main content
100%

drawing squares

✓ Published0🌍 Public
Ddumbdataguy@gmail.com
Last edited Nov 21, 2023
Created on Nov 21, 2023
Forked from Hello VizHub

This example demonstrates how to draw a series of rectangles whose widths correspond to values in a local data array. The rectangles are vertically aligned and randomly colored, with a tooltip appearing on mouseover to display each rectangle’s value. The visualization uses D3.js v5 via a CDN import, leveraging `d3.select`, `d3.sum`, and `.enter()` to build SVG rectangles. The code also imports a local ES6 module for the message text and uses D3 event handling with `d3.event` for positioning the tooltip.

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