Skip to main content
100%

Rotated axis labels in v4

✓ Published0🌍 Public
Dd3noob
Last edited Jul 3, 2016
Created on Jul 3, 2016

This example shows a simple line chart of stock closing prices over time, with the x-axis labels rotated at a steep angle to prevent overlap. The graph uses d3.csv to load the date and close value pairs from data.csv, then renders the line with d3.line and scales using d3.scaleTime and d3.scaleLinear. After drawing the axes with d3.axisBottom and d3.axisLeft, it applies a rotation transform of -65 degrees to the tick text, along with adjusted text anchoring, to make the dates readable.

AI-generated description

This is a simple line graph demonstrating rotated axis labels. This was written using d3.js v4 and is a follow on to the simple graph example here.

This graph is part of the code samples for the update to the book D3 Tips and Tricks to version 4 of d3.js.

Similar vizzes