I would like to automate my bar graph. Currently I’m creating a new line for each unique entry to the database. Is there a way to do this with some kind of ‘SELECT DISTINCT’?
An example of the first line is;
CASE WHEN COUNT( ) FILTER(WHERE TestView.category = ‘python_test_assert’) > 0 THEN COUNT() FILTER(WHERE TestView.category = ‘python_test_assert’) ELSE null END AS python_test_assert,
In SQL if you group by unique key is same result than distinct function,
may you can work around with that :
In this tutorial, you will learn how to use PostgreSQL GROUP BY clause to divide rows into groups.
Est. reading time: 6 minutes
i think you don’t need your case too
I tried it, and it sort of worked. But now everything has the same color, as well as that the categories don’t show up in the legend;
nice ! perfect
legend and color are panel options
Well, everything is marked as category_type. Is there an override to change color of bar based on value of category_type?
yes ! maybe you can try first basic color option like “classic palette”,
if it’s not working you can make value mapping,
if still not try to do this with override to target the right column
I have tried all of them:/
you are right i can’t do it too…
It’s should work on label override of label column but it’s not .
I could do it through
Ah, that’s a bit annoying though…
Thanks for trying atleast! Appreciate it!
@yosiasz can you try to color that by name of series ? i can’t on 8.3 grafana
same here I can’t do it with Value mapping
I managed to get it working by setting the “Color by field” attribute