It is also used more casually on individual occasions where someone has provided/done something and you might say legend! to show more enthusiasm than just saying thanks or well done.
Person B - Ah you legend i've been looking for that for ages!'
2 - Person A - *opens door a third time for guy that keeps forgetting their keys*
Person B - Cheers, you legend!