Dashboards & Visualizations

how can i rename the values in piechart

navd
New Member

I have piechart created and i want to rename the values that i have for all the pie slices .

Tags (1)
0 Karma

niketn
Legend

@navd, if the field name for pie chart label is field, you can apply the following replace() command with regex match to retain only text after semicolon.

 <YourCurrentSearch>
| eval <yourFieldName>=replace(<yourFieldName>,"([^;]+);(.*)","\2")

Following is the run anywhere search for reference:

| makeresults
| eval field="compute;good count(6424)", value=6424
| append [| makeresults
| eval field="server;notify count(64)", value=64]
| fields - _time
| eval field=replace(field,"([^;]+);(.*)","\2")
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

niketn
Legend

@navd, is this different from your previous question https://answers.splunk.com/answers/614546/display-the-values-on-pie-slice-in-pie-chart.html ?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

navd
New Member

yes ,now I wanted to rename

0 Karma

niketn
Legend

Ok, refer to answer below for this question. Also please accept the answer to your previous question if one of the suggested answers has worked out for you.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

493669
Super Champion

You can try case statement:

<base search>|eval etc_state=case(etc_state=="compute;good" ,"good",etc_state=="server;notify","notify",1==1,"")
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

HI @navd,

The labels are coming for events so you have to change before chart or stats command.

Can you please share your sample search & sample data (old label and new label)?

Thanks

0 Karma

navd
New Member

I have the statistics like this :

etc_state count

compute;good count(6424) 6424
server;notify count(64) 64

So,here I want to rename compute;good as Good and server;notify as notify

0 Karma
Get Updates on the Splunk Community!

Wrapping Up Cybersecurity Awareness Month

October might be wrapping up, but for Splunk Education, cybersecurity awareness never goes out of season. ...

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

&#x1f5e3; You Spoke, We Listened  Audit Trail v2 wasn’t written in isolation—it was shaped by your voices.  In ...

What's New in Splunk Observability - October 2025

What’s New?    We’re excited to announce the latest enhancements to Splunk Observability Cloud and share ...