Is there any way to change the order of Grafana panel stacked series that come from the same PromQL query?
This is very easy when there are multiple queries (just drag and drop up or down), but I don’t know how to do it when all those series come from the same query.
If I do this 3 queries separately I can order of panel series:
If I do this this single query I get all the same results but no control of series order:
welcome to the community @francardoso93!
I was curious about your question and found this old github issue that says the stacks sort in the same order as the legend: Stacked series sort issue · Issue #9789 · grafana/grafana · GitHub
I tested it out and it seems to hold true even though it’s not documented, give it a try and let me know if it works for you too!
The options to change in the bar chart to get the stacks sorted are:
In the legend section of chart options, choose a legend value to sort by. Now, you can click the value header in the legend and see the legend sort:
In the standard options section for the bar chart, choose a value based color scheme and a value to color the series:
I tested with the stacked bar chart here on play.grafana.com and saw the bars change order depending on the legend sort