How is avg. resting heart rate calculated?

Anyone know how avg. resting heart rate calculated? While sleeping I am usually in the mid 40's according to the graph. 7 day average is in the mid 50's most of the time. So resting heart rate is not your sleeping heart rate?