Skip to main content
100%

text on new line

✓ Published0🌍 Public
AAnimesh Nautiyal
Last edited Jun 22, 2021
Created on Jun 22, 2021
Forked from D3 Starter

This example demonstrates how to break a single string of text into multiple lines within an SVG using D3 version 6. It shows a fixed message containing newline markers (written as “/n”) that are split into separate `<tspan>` elements for rendering. The code uses `d3.select` to target the SVG container, binds the data array, and appends a `<text>` element with each line positioned via `dy` offsets. The rendering approach relies on SVG text and tspan elements, with styling applied through D3’s `.style` method.

AI-generated description

A demonstration of how to start using D3 version 6.

MIT Licensed

Similar vizzes