Hi,
I am new using Grafana. I need to create a pie chart in Grafana from a postgreSQL datasource.
My table has the structure (time, user, count), and I would like to represent the maximum number of count per user, so I would need to have one section of the pie per user. Is that possible?
I have already read this topic regarding the pie chart:
https://localhost:3000/t/pie-chart-plugin-example/9068
but I couldn’t manage to get the desired result.
I have tried:
SELECT
now() as time,
MAX(count)
FROM
shema.table
GROUP BY user
But I only get all the pie in the same section with the value of the max count for all user, not the maximum per user.
Thanks in advance!! 
Hi Dharma77,
This is related with postgres, not to grafana.
Can solved it in the following way:
SELECT
now() as time,
MAX(count) as value,
user as metric
FROM
shema.table
GROUP BY user
1 Like
Hello, I have some problems with the pie chart. I use v7.5.5, and then use the following statements:
SELECT
now() as time,
principal as metric,
count(1) as value
FROM jhi_persistent_audit_event
GROUP BY principal
The results are as follows:
The tag name of the pie chart I want to display is the value of metric, such as admin, but the tag name it displays is not what I want to display. As shown in the figure below:
What did I do wrong?How can I modify it
1 Like
What grafana version are you using?
The version I used was 7.5.5, and I later tried to use 8.0.2, but the new version didn’t have this problem
1 Like
Hey!
how do I create the pie chart without using now() as time.
I have a timestamp field which I want to use as time.
For eg if the value in timestamp field is 5/11/2021 it should count the values ahead of the date 5/11/2021.