added a checkbox to allow dynamic sorting of the legend labels/histo