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.

Welcome

Can you try this and see what happens?

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

or if you do not want to see the legend you can do

image

1 Like

thanks,that solved my issue