Skip to main content
100%

Directly Labelled lines

✓ Published2🌍 Public
MMark Lam
Last edited Jan 19, 2022
Created on Jan 19, 2022
Forked from D3 Starter

This example demonstrates directly labeled line charts by placing category names at the end of each line instead of using a legend. The chart shows three food items (Apples, Blueberries, Carrots) plotted over a four-month period, with labels positioned using a Voronoi diagram to find the largest empty cell for each line. The code uses D3 v7 for scales, axes, and line generation, along with the geometric library to calculate polygon areas, centroids, and angles for label placement. Data is loaded from a CSV file and rendered as SVG paths with light-colored lines and matching text labels.

AI-generated description

A demonstration of how to start using D3 version 6.

MIT Licensed

Similar vizzes