You have to compensate for whatever decoration/primitive you want to be dynamic the same way I compensated for the axis title. If you have a legend, take it into consideration when calculating the extent.