One of the best features of our new FRED graphs is the ability to easily embed them in your own blog or website. The embedded graphs even retain the interactive tooltips and zoom capability! It takes just 3 easy steps.
Customize your graph as you normally would using the options below the graph by clicking on the “Share Links” button. Click on the “Embed in website” option.
After clicking on “Embed in website,” a pop-up window will appear with options for your graph. If you have the latest observation on your graph, you will receive options based on the time range of your graph. You are given three options for the date range: a rolling window of the same length, a sample always starting at your chosen date and ending with the most recent data point, or the exact date range the graph shows. If your time range does not include the most recent observation, you will not have options as illustrated by the second image. Clicking on the copy icon next to the red arrow will copy the link used for embedding your graph. After copying the link, click the “Done” button.
Paste the code into the HTML of your site…and voilà!
There’s another way to control the date range displayed in the graph as time passes. Once you save a graph to your account, you are given three options for the date range: a rolling window of the same length, a sample always starting at your chosen date and ending with the most recent data point, or the exact date range the graph shows at the time you saved it.
STEP 4 (Optional)
For a responsive graph: Wrap the embed code in a <div> block element with a class of embed-container:
<div class='embed-container'>EMBED CODE</div>
Include the embed.css file on your page above the embed code:
<link rel="stylesheet" href="https://fred.stlouisfed.org/graph/css/embed.css" type="text/css" media="all">
Include the embed.js file on the bottom of your page: