Skip to main content
100%

Rotated axis labels in v6

✓ Published0🌍 Public
Dd3noob
Last edited Sep 12, 2020
Created on Sep 12, 2020

This example shows a line graph of stock closing prices over time, with the x-axis labels rotated at a steep angle to prevent overlap. The chart is rendered as an SVG, built with d3.v6’s scaleTime, scaleLinear, and d3.line for the path, while d3.axisBottom and d3.axisLeft generate the axes. After drawing the bottom axis, the code selects its text elements and applies a rotate(-65) transform along with adjusted text anchoring. The data comes from the included data.csv file, parsed using d3.timeParse.

AI-generated description

This is a simple line graph demonstrating rotated 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

Similar vizzes