… i.e. to make the x axis be always in the middle of the graph no matter there are data points to put down or up or not.
The issue is that in case there is no data to put down, the graph looks like the following
… showing only the part of the graph there is data for, but I’d like the bottom part to be always visible even if there is no data and to be centered vertically (I know there is min value in the widget settings, but in that case it will be hardly possible to make the x-axis in the middle)
Let’s consider that I set these options to -10 and 10 correspondingly and then write into the metrics system value of 100.
In that case Grafana will render the graph so that the y-max will become equal to 100 and y-min value remains equal to -10.
What I’d like to achieve is make y-min and y-max values change so that y-max = -y-min and vice versa depending on whether there is data for the corresponding part of the graph or not.
Currently there is no native way to do what you want. But I can tell you some trick to achieve it. The first thing you have to do is create a fake metric. This metric can come from any datasource, have any value and any name. then in ‘series override’ you hide it, that is, you take away the lines, points and bars, you also have to hide it from the toolip and the legend; you must also assign it to the “right y” axes. After doing this, on the “right yt” axes, you set a minimum and maximum value equal (-1 and 1) and configure the axes so that they align to the value 0.
voilà!