Splunk IT Service Intelligence

How do you convert thousands to K in a column chart?

Engager

Hi everyone,

I'm trying to make a column chart where I want to display the values with the K notation when the number is greater than 1000 please.

Basically, I have a query that returns a table with two columns : month and number of events.
I've figured out how to create a column with the K notation by doing this :

... | timechart span=1mon count |  eval k = round(count/1000, 1) | eval k_final = tostring(k)."K" | rename k_final as "Dossiers terminés" | fields - _span k k_final | table mois_fr "Dossiers terminés" k_final

The problem is that it is not possible to create a chart from string values...

Has anybody got a solution please ?

Thanks in advance

0 Karma
1 Solution

SplunkTrust
SplunkTrust

The solution is to remove the "K" from the field. Add "(K)" to the axis label of your chart so users understand numbers are in thousands.

As an aside, there is no need to include kfinal in the fields command as that field no longer exists because it was renamed. For the same reason, you also can remove 'kfinal' from the table command.

---
If this reply helps you, an upvote would be appreciated.

View solution in original post

SplunkTrust
SplunkTrust

@sprayer122 if you are on Splunk 7.0.0 or higher you can use Simple XML Chart configuration reference to convert axis labels to actual to abbreviations using K format.

charting.axisX.abbreviation : (none | auto) 
charting.axisY.abbreviation
charting.axisY2.abbreviation    

For example:

 <option name="charting.axisY.abbreviation">auto</option>

PS: Enables the abbreviations of large X, Y, and Y2 numerical values with the closest SI prefix, default value is none
charting.axisY2.abbreviation is not supported for scatter and bubble charts.

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

SplunkTrust
SplunkTrust

The solution is to remove the "K" from the field. Add "(K)" to the axis label of your chart so users understand numbers are in thousands.

As an aside, there is no need to include kfinal in the fields command as that field no longer exists because it was renamed. For the same reason, you also can remove 'kfinal' from the table command.

---
If this reply helps you, an upvote would be appreciated.

View solution in original post