Reputation: 1879
I’m trying to get data structured like this:
to look like this:
I am using the Graph Visualization with X-Axis mode set to Series.
My query is:
select
t.name as Value,
round(sum(i.points)/12, 1) as Metric
from
event e,
issue i,
team t
where
i.key = e.issue
and t.id = i.assignee
and e.type = 'Closed'
and t.role = 'DEVELOPER'
and e.date < (now() - interval '1 year')
group by Value
order by Metric
;
I’ve been reading Grafana Community topics and modifying my query for days. I can change the query/data structure to make this work. I would really appreciate some help.
Thanks!
Upvotes: 1
Views: 4328
Reputation: 11
You can do this by using Bar Gauge visualization. In Display section choose Show: All values, Mode: Basic, Orientation: Vertical. In Field section choose Title: $__cell_0. It will show the bars with the correct titles but you won't be able to display the texts with vertical orientation.
Upvotes: 1
Reputation: 28656
Grafana is designated for time series. Yes, that is not your case, so you need to fake it - try to create fake "time" column with some value (current timestamp, constant, ...) (IMHO you have mixed metric/value):
SELECT
1 AS "time",
t.name AS metric,
round(sum(i.points)/12, 1)
FROM
event e,
issue i,
team t
WHERE
i.key = e.issue
AND t.id = i.assignee
AND e.type = 'Closed'
AND t.role = 'DEVELOPER'
AND e.date < (now() - interval '1 year')
GROUP BY 2
ORDER BY 1,2;
Out of the scope this question: probably LEFT JOIN will be better to join tables
Upvotes: 1