Change color-label names

Hi to all the great team!
I have an index with 2 docs where i store active / inactive systems (one doc for 'active' and the other doc for 'inactive'). This index is refreshed every 10 minutes with new values of active / inactive systems.

How can i change the color - label names in top right of my pie chart as it is shown in the image below? I just want to display 'active' for the green and 'inactive' for the blue.

Hi @johnkary,

can you how the chart is configured (metrics and buckets) and how your data looks like?

Hi @flash1293 and thanks for the quick response!

Here is the details you asked for:

I see, thanks for the details.

If you control the ingested data, consider changing the shape of your documents to something like:
{ type: "active", count: 24 }
{ type: "inactive", count: 2 }

Then you can create your pie chart by using a terms agg on the type field for your slices and a sum agg on count for your values. the pie chart will pick up the type values as labels for the legend automatically.

1 Like

Hi again!
Thanks! I did what you said and is ok at some point (i mean the label on top right), but i lost the numbers on the circle. Is there any way to keep my numbers there?
See below:

Unfortunately the pie chart will always show percentages, not total values.

If you know for sure there will always be 2 documents in your index, you could put the count in the type as well:
{ type: "active 24", count: 24 }
{ type: "inactive 2", count: 2 }

However, I suggest switching to a vertical bar chart, you can show the total values as part of the bar there like this:

@flash1293 Ok, it doesn't matter! I choose the first option with the pie chart and it worked fine with the following:

{ type_systems: "active", count: 24 }
{ type_systems: "inactive", count: 2 } 

But, there is an issue here when i try to put this visualization in a dashboard... I get the error bellow. Any ideas?


Maybe you have to refresh your field list. Go to management > index patterns > and press the reload button in the top right. This should pull in new field names.

1 Like

That's right! I forgot to do this simple move :slight_smile:
Now it's ok, it worked!

Really thank you again!
Best wishes!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.