Draw static lines

Hi, I’m using grafana on influxdb for water height, everything is ok, but I have static data like a max height for a named date (flood dates) and I want to draw them has horizontal line on same graph. Is there a way to do this? SHould I store this in influxdb first, but it’s not time series, it’s constant data?

Looks related: https://github.com/grafana/grafana/issues/9085

Even if you say that it’s constant, it must still have a start time and end time. One way to do it would be to add a series. My suggestion is to add four points :

0.0, start time
constant, start time
constant, end time
0.0, end time

Then add this series to a graph, remove the mean() and group by time($__interval). Go to the Display tab, Under Stacking& Null value, Null value, change to connected. That will connect the four points together.

You could use a threshold line and deselect the fill, leaving only the threshold line.
Works in my use case at least:

1 Like

How to give threshold value dynamically?
In my use case, I am plotting an average horizontal line, by giving static value I am able to plot a average line. But how to update the average line when ever data is inserted.

1 Like

That is very cool @mountaindude. Thanks. I found this searching for horizontal lines but I even decided I want the fills after playing around with thresholds, so thresholds are even better for my use case than just drawing lines, which as you point out is also possible using thresholds, so again, thanks!

What would the actual query look like to plot those 4 points?

1 Like

Mod here: we’re going to close this topic since it’s over 2 years old. Can you please reference it in a new post or direct message the person you’re trying to get a follow up on?