Netdata Community

Feature request: Sort graph legend

Hi all,

When looking at a graph with a lot of metrics (e.g. menu_users_submenu_mem, which on my system has 20+ lines), it’s hard to figure out which metric is which, mainly because visually distinguishing between similar colors gets progressively harder when there’s more than 7.

  • If the legend could be sorted to match the order of the metrics in the graph, that would help a lot.

  • Ideally, if the legend was to the right of the graph, the lines could roughly line up with the corresponding entry in the legend, at least until there’s too many entries in the legend to fit. At that point, a ‘top-ten’ (or ‘top-N’, or ‘bottom-N’) function might be needed.


Hi @cho :wave:

if the legend was to the right of the graph

Do you know that it is configurable? See Dashboard Options->Visual->Where do you want to see the legend?

That’s great!

Now, about the sorting of the legend to match the lines on the graph, is there a dashboard option for that?


Unfortunately, there is no any sorting functionality.

But what do you mean by


I think some sort of hover type feature would be really helpful. So if you could in some way display what something is when you hover or click on the line in some way.

I think I asked about this before and was tricky with the current charting library.

Could be a good feature request though as is something I also struggle with sometimes especially when lots of dims on a chart.

Yes, if

  • there are a lot of dimensions
  • their names length is different

it makes it very hard to find something

Here it is with the legend on the right:

The question that comes to mind first is: what’s using the most memory? It would be nice if the answer was “the first one on the list”. Instead, I have to find the correct reddish-brown metric in the legend.

Another question might be: how much memory is the ‘netdata’ account using? If the list was sorted alphabetically, it would be quick to find.

Yet another question: what caused the bumps in the graph?

From looking at this screenshot, it does look like the legend might be in the same order as the lines: the top eight lines together used 0.01 GiB of memory, so they all got squished into a thin yellowish line at the top. Then came ‘named’ and ‘clamscan’, then another invisible line for ‘opendkim’, etc, etc. Sorting by value would move the ‘unimportant’ lines out of the way.


For more complexity (as if we needed more :slight_smile: ): the value shown in the legend is the last value of that metric (or dimension), but sometimes that’s not what the user wants. Sometimes it’s the maximum value, or the minimum, or the average, or the first. Or maybe the time of the last/first/min/max value. The possibilities are endless.