The graph is triggered automatically for any PubMed search that results in more than 100 citations and it will appear on the right side of the search results page (example).

For a smaller number of retrieved records, you can can generate a custom graph by using the Publication dates facet (on the left side of the search results page). You can set Custom range by individual years. Alternatively, you can add the publication date range to your search term, for example:

honey allergy AND ("2011/01/01"[PDAT] : "2011/12/31"[PDAT])

Adjust the year in the search term for all subsequent searches.