Min or Max depending on field value

Grafana v8.0.6 (68fe9e3431) / Influxdb

I would like to have the time series display either the min or max value depending on the field value. Anyone could suggest an easy way to achieve that?

For example I measure a current every second. If it is positive I want to see the max value, and if it is negative see the min value.
The purpose is so that when I select a large time range, I can see the extreme values. I am currently using average, but those extreme are truncated if they do not last long enough in relation to the time range.
If no easy way, I will have two lines: Min and Max.
Thank you for any suggestion.

I’ve been trying without luck to think of a way to conditionally display min vs max in Grafana. If this is more of a display bug that you’re trying to resolve, have you fiddled with the soft min and soft max features added in Grafana 8?

Thank for the idea. I will investigate Grafana 8 soft (min/max) feature.
Not a display bug, just a feature to avoid having two lines for each series on the panel.