Set colors defined by other attribute

Using grafana 11.5.1 on Rocky linux

I am showing a time series of data points from some environmental measurements stored in a postgresql time series database.

Each measurement may be one of four different classes:

Null, below detection limit, above detection limit but normal, above normal value

The classification is done before the data goes into the database, so I can get out (among others) the following attributes:

  • Time, timestamp
  • Value, floating point
  • Classification, integer, 1-4
  • Detection limit, floating point
  • Normal limit, floating point

From this I can easily make a plot with three datasets, my measurements, the detection limit and the normal limit. In addition I would like to mark the measurement points with different colors depending on the classification. As the detection limit and the normal limit depends on other parameters in the sample, they are not constant values, so I cannot, as far as I can see, use the normal treshold values to color the points.

Can I somehow, using time series or other types of panels, plot value versus time colored by level?