How to sort the legend?

  • What Grafana version and what operating system are you using?
    11.0.0

  • What are you trying to achieve?
    I´d like to sort my legend on custom behaviours e.g. ERROR, WARN, INFO instead of INFO,ERROR,WARN

  • How are you trying to achieve it?
    I tried to use the Legend-Options but there is no sorting available.

Also i tried to use the transformation with the option sort, but this also didn´t gave me the solution

  • What happened?

  • What did you expect to happen?
    Sort the legends on custom behaviours or at least descending, ascendig and not randomly

1 Like

Legends are sorted in descending order based on their value. In your example,
info - 42%
error - 39%
warn - 19%

That’s the reason legends are shown this way. if the value of these changes, the legend’s order will also change.

1 Like