A time scale maps continuous time-related values to continuous screen positions. In D3, d3.scaleTime() positions dates along a chart axis by translating a date domain into a pixel range. section 4.1.2
For a line chart, derive the domain from the first and last dataset dates, then map it across the chart’s inner width. Pair the x-axis time scale with a linear temperature scale for the y-axis. section 4.1.2
const firstDate = d3.min(data, d => d.date); const lastDate = d3.max(data, d => d.date); const xScale = d3.scaleTime() .domain([firstDate, lastDate]) .range([0, innerWidth]);
Builds a time scale from the dataset’s earliest and latest dates, mapping them to the inner chart width. section 4.1.2
