Force Y-Axis Max to a variable

I’ve been raking my brain to try to find a way to display a number of graphs on a page to the same Y-axis scale.

I have multiple graphs showing motor current from various systems.
To visually compare motors from a given system, I need the Y-axis to be consistent accross the graphs on the dashboard.

The problem

  • Setting the Y-Max to auto means each motor current graph will have its own scale and it makes it very hard to compare the graphs on the page.
  • Setting the Y-max to a fixed value means that when showing motor current graphs from one system, the scale will be too large, and for other systems the scales will be too small.

It seems there is no mechanism to use a variable as the Y-max. I’m trying to find some ways to force the graphs to all show the same scale based on the system being visualized but I’m hitting walls.
I’d even be happy if I could set the scale through a dropdwn variable the user could select…

I’ve looked at Expressions to try to add a series with a fixed value that I could maybe hide but might help force the graph to scale to but can’t find a way.
I’m trying to understand Transforms, but it doesn’t seem to be helpful in this case (even though a closed ticket seems to imply this was now possible).

So surely I’m not the only one who has a need to be able to set the Y-max of graphs in a dynamic way based on some variable/query data.

I’ve tried to find other enquiries on this board but none seems to have any or useful answers and all related tickets I could find on the subject seem closed.

Anyone has any idea?

1 Like

Hi @renaudbompuis

What version Grafana are you running? Have you evaluated the new beta transformation config from query results?

I have the latest version 8.1
I had a look at that doc but I’m not getting it. I don’t understand how this is practically applied to change the chart configuration.
It there a more fleshed out example somewhere?

I have my database query A returning one or more series (motors) and their data points (currents) over the chart user-defined period and location (location is a variable chosen by the user).

Based on that user-selected location, I would like to have different Y-axis scales for the motor data being displayed.

Now I know I need to have a query somewhere that can return a specific value from that location user-selection.
I can have a B query do that (something like SELECT MAXSCALE FROM CONFIGTABLE WHERE LOCATION=$location for instance)

However, I still don’t get how I match that result to set the max scale of the data being displayed.