Formatted time labels for an axis with v6
✓ Published0🌍 Public
Dd3noob
Last edited Sep 12, 2020
Created on Sep 12, 2020
This line chart displays stock closing prices over time, formatted with precise date labels on the x-axis using the `%Y-%m-%d` pattern. The chart uses d3.line to plot the data series, d3.scaleTime for the temporal domain, and d3.axisBottom with tickFormat to generate the labels. The axis text is rotated -65 degrees and anchored to the end to prevent overlap, while d3.csv loads the sample data, which includes dates like 1-May-12 and corresponding closing values. The SVG rendering includes a steelblue path and margins configured for the rotated labels.
AI-generated descriptionThis is a simple line graph demonstrating rotated / formatted axis labels.
This graph is part of the code samples for the update to the book D3 Tips and Tricks to version 6 of d3.js.
mit Licensed