Heyo, I have a data set with three columns: country, user count and another count. I wish to display the data set with two pie charts: the first one displaying the user count by country and the second one the other count by country with the requirement that both pie charts would display the same color for the same country. I got what I wanted by creating a panel that holds the query and then selecting that panel as the datasource for both pie charts. However, the pie charts repeat the column names for each country. Is there a way to get rid of the repeating “User Count”?
The “rename fields by regex” transformation was made for this but I’m having problems getting it to work
Me too, I cannot target the “User Count” part to make it an empty string
Ahh so the transformation is to rename the fields, things like “Denmark user count” would be a field value.
If you pivot the table, you can get this to work.
So instead of
United Kingdom User Count,5
USA User Count,7
Canada User Count,2```
```United Kingdom User Count, USA User Count, Canada User Count
and provided the `(.*)User Count` transformation, it would work
Oops I got the other one, although its not as intuitive.
1.) Go to Value Mappings and add a value mapping
2.) Ignore what is pre-populated. Add a new mapping, and select Regex
(.*) User Count as the expression and
$1 as the display text
I tried your second suggestion, it didn’t apply the value mapping, do I have to still pivot the table?
Nope, not for value mapping
Oh I suspect it’s because of this Transform option that my Value mapping is not working?
Ha thats something Ive never played with. Let me see if that affects the value mapping stuff
I have it enabled because the pie chart I am working on is using the data from the second column and I want to show the same top 10 entries as the first pie chart, but for some reason if the option is not enabled, it takes seeming random 10 entries
Whereas the pie chart that uses the first column does not need this option enabled (because I sort my data descending by the first count column?)
This option also syncs the coloring of the countries to be the same between the two pie charts
Yeah unfortunately since both the field regex and value regex are going to be operating off the original values and adding on the “User Count” field name to the country in the legend is something done after the fact by Grafana, I don’t think we can do that right now. The pie chart is most likely assuming with 2 values, the label of what value they’re showing is necessary - not the case for you since you have both values showing in different panels. If you remove one of the values so its just key-value it doesn’t put the field name in the legend. This won’t work for how youre referring to one panel from another though
I’m writing up a feature request for ya