Based on 11,032 Treasury auction results
The US Treasury issues debt by selling bills, notes, and bonds at auctions. The results are published here. Opening the "Competitive Results PDF" for a given security shows something like this:

Each auction result includes several important details:
The full auction results are also available programmatically at fiscaldata.treasury.gov. We use this API to download every auction result. (see download.py creating ./data)
The following show the distribution of bond terms (the time from issue to maturity)
Based on this distribution, we bin securities into four term categories:
To turn individual auctions into the debt-over-time chart, we treat each security's Total Accepted amount as outstanding on every day between its Issue Date and Maturity Date. For a given day, the total debt is simply the sum of every security whose life span covers that day, split into the four term brackets described above.
The interest cost is computed the same way as above, but instead of adding the face amount we add amount × rate (the annual coupon), where rate is the security's interest rate for notes and bonds, or its high investment rate for bills. TIPS are handled separately because their coupon is paid on an inflation-adjusted principal, so we scale their interest by the Treasury reference-CPI index ratio on each date.
The third chart shows the interest rate the Treasury pays on newly issued debt, per term bracket. Since a week can issue securities of different sizes, we compute an amount-weighted average of their rates, so a $50B issue counts five times as much as a $10B one:
rate = Σ(amountᵢ × rateᵢ) / Σ(amountᵢ)
A single week's issuance is noisy, since each week mixes securities of different maturities and reopenings that carry old coupons. To smooth this out, the weighted average above is taken over every security issued in a trailing window, not just the current week. The window length is per bracket, because short-term bills are auctioned very often while 20 and 30-year bonds are issued rarely; a longer window fills the gaps between those infrequent auctions:
We overlay the federal funds rate for comparison.
All of the code and data used to produce these results are available on GitHub:
download.py, data/, compile.py, results.json.