There are frequent requests to sort color-by legend groups by a statistic (often count, sum, avg) for some data column shown on that graph. I suggest to generalize this by making it possible to sort any categorical legend group (color, symbol) by any statistic (of any column) for groups that are displayed in the legend. Show values for that statistic in the legend by adding a tiny bar graph (or sparkline) for that statistic to the legend. (Alternative to the tiny graph might be to just display the statistic value) This increases chart information density. It provides more quantitative information for data dimensions displayed on the graph and makes it possible to sort the group items by some important statistic so the items of most interest are at the top of the legend group. See attached example of possible legend UI and data display.
Since column sort order seems to determine the order of items in a legend group, it may be possible to generalize this further by allowing user to set sort order of items in a string column based on any statistic for any column. It is not currently possible to do this.
Related ideas:
Attaching file