Skip to main content
Public

Share visualization

Loading preview…

D3 base module starter

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

D3 base module starter

2
AAlpineStranger
Last edited Jan 16, 2023
Created on Jan 16, 2023

This example demonstrates a minimal modular setup for D3 v7, rendering a static text message to an SVG canvas that fills the browser viewport. The code uses `d3.select` to append an SVG element sized to `window.innerWidth` and `window.innerHeight`, then applies a custom reusable module via `svg.call(mod)`. The module, defined in a separate file, exposes a `val1` setter and appends a text element with the provided string. It illustrates a clean, component-based pattern for organizing D3 code without any data binding or interaction.

AI-generated description

Modular baseline using D3

Comments

Sign in to join the discussion.

MIT Licensed