remove from legend unused elements