21

Is it possible to order the columns in a Grafana Table?

I have a Table (sourced from InfluxDB) but the columns are in a «wrong» order... I tried changing the order of the Group By clause in the InfluxQL but I get the exact same results.

Paul
  • 301
  • 1
  • 3
  • 8

7 Answers7

27

When you edit a table view, Just next to Query tab (below the table), there is Transfer tab. You can :

  • hide using "filter by name"
  • reorder using "organize fields" Works with 7.3.0

enter image description here

pl.square
  • 499
  • 5
  • 5
5

If you explicitly list the columns you want from InfluxDB they will be in that order in the table. If you use select * you don't have control.

The time column always comes back from InfluxDB as the first column. There is nothing you can do to control that (for now).

You can hide the column using a column style of hidden.

If you meant rows instead of columns, ask a new question.

  • 2
    Hi Frank, All your cases work as you said, but do you have a solution for when the columns we want to sort come from a GROUP BY clause? – Jorge Diaz May 07 '18 at 09:19
  • Can you change the order of the columns once you fill them in without destroying your whole query and starting over? I added a dozen columns with various modifiers for a table, and now I want to add a new one at the beginning. I can't figure out how to insert one at the beginning other than by switching to SQL (from which I cannot switch back). – Micah Zoltu Aug 19 '18 at 15:13
4

Using "Edit" option in your table, you can select "Transform" (arrow#1) and then hide a column by using the "eye" icon (arrow#2) and reorder table columns by grabbing the rectangular icon at each column (arrow#3) and move it up/down. Find those arrows in the image here:

enter image description here

bad_coder
  • 11,289
  • 20
  • 44
  • 72
AB2
  • 41
  • 4
1

Column reordering is available since Grafana 7.0 via organize fields transformation.

akamch
  • 98
  • 1
  • 4
0

Was looking for the same and found a solution. So, when you use the built-in query and select '*' in field(value) it gives you all columns and as influxDB table columns (it will be returned in alphabetical order). But, I wanted my order to be different so I wrote a query which consisted of all the column tab names mentioned, separated by commas.

So within the table panel - Metrics -> Click on button next to view symbol and choose (Edit Toggle mode) and enter your query. The query should look something like this -

SELECT "field_1","field_2","field_3","field_4" FROM "autogen"."measurement_name" WHERE $timeFilter

you can probably write a script to help you create these scripts when you are entering data into your influxdb series.

0

OK, So... this is a very hacky solution, but you can make multiple queries to get the results in the order you want.

Say you want want the order to be "field_2","field_3","field_1","field_4"

Query A can be SELECT "field_2","field_3" FROM "autogen"."measurement_name" WHERE $timeFilter

Query B can be SELECT "field_1","field_4" FROM "autogen"."measurement_name" WHERE $timeFilter

This works with prometheus, I have not tried with influx... but i don't see why it wouldnt work the same.

-1

Did you try to play with the ORDER BY clause in Influxdb ? It worked for me to invert the result of the query in order to have the newest points fisrt in my Grafana table.

Remy F
  • 1,479
  • 15
  • 20