Move all legend functionality to the related table.