Bar Gauge was sorting after update

Hi,

I had a dashboard running in v7.5.2 using some Bar Gauge panels to display sales results. This server was recently updated to v8.2.2.

Data is retrieved from a SQL Server and SQL code has a sort at the end.

The resulting data when run in SQL Server is…

Time,      Region,        Value
----       ------         -----
time,      Region3,       £1000
time,      Region5,       £800
time,      Region2,       £700
time,      Region1,       £400
time,      Region4,       £100

The Bar Gauge Panel has been set to Time Series, despite the fact the data isn’t time based (Col1 is just to make it work). The reason we do this is because this allows us to use overrides to force the colour of the bars to ensure each region is always display by the same colour.

Looking at the raw data returned via Query Inspector it looks like Grafana switches each row as a new column and this appears to be in alphabetical order so displays like this…

Time, Region1, Region2, Region3, Region4, Region5
----  -------  -------  -------  -------  -------
time,  £400,   £700,    £1000,   £100,    £800

*NB: I never checked this in v7.5.2 so not sure if the column order was based on the retuned SQL data. It’s only now that I am trying to fix it I have found this.

If I go to the transforms then this only allows me to sort by Column so only offers me Region1, Region2, Region3 etc

If we change to Table format instead of Time series, the data does display correctly in the order returned from the database query, but we lose the colour overrides so can no longer set the region colours. The overrides now only give us the option of searching for columns (Region, Value) rather than row values (Region1, Region2 etc).

Something definitely changed, as it was working for 6 months, and then after an update (using yum update) to v8.2.2 it just stopped sorting.

Can anybody shed any light on this?

Thanks

Mark

This sounds related to the breaking change that SQL datasources went through in Grafana 8. I would read this note in the changelog, follow the links, and see if you think it’s relevant to your case. I suspect it might be. If so, the links offer workarounds and transformations to migrate tables like these into G8:

This topic was automatically closed after 365 days. New replies are no longer allowed.