Adding option to sort legend by value