Apply numeric ordering to fields (dynamically)

Grafana version: grafana-v10.3.1

I have 3d data (2 coords + z value) and want to be sure each axis is in the correct order (numeric ascending). The query can only give the right order to one coordinate. e.g. ORDER BY x, y produces the following:

x y
0 1
0 2
0 5
1 4
1 5

The y axis would then have an order like 1, 2, 5, 4…

I first am using a “Grouping to Matrix” transformation to help with formatting the data. So I would get something like this:

x/y 1 2 5 4 …
0 z’s…
1
2

Then I apply an “Organize fields by name” to order the columns appropriately (note the 4 and the 5 switch):

x/y 1 2 4 5 …
0 z’s…
1
2

This works great! The transformation already has the fields ordered numerically when it spawns. I just drag the “x/y” field to the very front. However, when I then go to the dashboard and change a variable, the ranges of values change and the “Organize fields by name” transformation simply takes the order returned by the query, rather than doing what it would have done, had I simply applied it by hand again…

How can I make this work on it’s own i.e. dynamically? Can this work? It seems like an expected functionality, to be able to order columns/rows by their numeric value at run time. Thanks!

PS - I am using Apache ECharts plugin which does not have the option to apply overrides.

@rob.loh You are welcome to open feature request to support overrides:

Hi Mikhail,

Thanks for the response. Not sure if an override would work appropriately either… Was looking for a quick fix, but I’ll just sort it myself in the javascript.

1 Like

@rob.loh You should be able to create the necessary login in JS.

I created feature request for overrides: