Templating variables as different colored series in graph panel

Hi! I’m quite new to Grafana and can’t seem to find the answer to this anywhere, so I appreciate any kind of help :slight_smile:

I have a templating variable of type query (article_id in the photo) and I would like to plot some function ‘avg’ that depends on the date and the article_id. I would like to have different colors of points depending on the article_id chosen (and of course a legend explaining colors). Right now, the points are always of the same color, and I can’t see which ones correspond to which article_id.
Is that possible?
I’m using Postgresql data if that’s important.

Yes thats possible. If you return a column named metric the value of that column will be used as series name. If you add article_id::text AS metric to your query you should get the desired result.

Thanks a lot!

Do you know if the same thing is possible with histograms insted of Time data? Because when I change x-axis mode to histogram the data is once again grouped into one series :confused: