(no-ticket) Statistics: Hide legend if not needed.

Change-Id: I44e85ac0fb45fca7671648ece322f2ec2b296e5f