Skip to main content
100%

lineGenerator with .x & .y Methodhs

✓ Published0🌍 Public
SSubhendu Karmakar
Last edited Dec 28, 2023
Created on Dec 28, 2023

This example demonstrates how to generate a simple line chart from an array of numeric values using D3’s line generator. The chart displays seven data points connected by a gray polyline, illustrating how the `.x` and `.y` accessor methods map each datum’s index and value to coordinates via `d3.scaleLinear` for both axes. The code uses `d3.line()` to produce the path data and appends it as an SVG `path` element. The data is a hardcoded array of objects with a `value` property, and the visualization is rendered as SVG.

AI-generated description

D3 Scales - scaleTime()

MIT Licensed

Similar vizzes