Remove legend column alias name from legend time series graph in grafana 8

I have a query in grafana using postgres as data source as such:

SELECT
  DATE_TRUNC('month', obsolete_date) as "time",
  product_type,
  count(product_type) as "_"
FROM
  evergreen
GROUP BY 1,2
ORDER BY 1

On grafana I get the following graph:

As one can see, the underscore is present in all legend values of my graph, whatever i type as alias for a column it will appear as the legend. I don’t want that, I want to just have the different values of the column plotted as text for my legend. How can i do that ? i tried regex value mappings on grafana but it did not work for me.

thanks,that solved my issue

Tried the same with …,sum(counter) as value,$__timeEpoch(timestamp)
but it didn’t work. In the legend the name “value” is shown in front of the names. Are there any other solutions? What works is sum(counter) as " "…

sum(counter) as value,
$__timeEpoch(timestamp) as time,
name as metric

you need the last one that describes the column that has the name/description of the thing you want to plot pn time series

Ok, i see. it just has be to the last one and alias has to be metric.

that would work as well:

sum(counter),
$__timeEpoch(timestamp),
name as metric

Thanks for clarification

1 Like