Calculate time range for the time axis.