Dashboards & Visualizations

How to get a Splunk 6.3 SingleView visualization to only show number precision with decimal places if available, not for integers?

gustavomichels
Path Finder

It seems the SingleView visualization in Web Framework v1.2 in Splunk 6.3 introduced a bunch of properties, one of them being called numberPrecision. The default is 0 with available options being adding up to 4 zeroes (like 0.0000).

I have a custom dashboard which displays percentages in single visualizations, and I want to use the decimal places but only when they are available. If the value is an integer (100%), I don't want to have extra zeroes added to it:

example

I don't see a way to do it with the current controls, something like "only round if not integer". Does anyone have any ideas?

Thank you

0 Karma
1 Solution

thirumalreddyb
Communicator
your query ...... | eval splits=split(value,".")  | eval count=mvcount(splits) | eval value=if(count>1,value,mvindex(splits,0)) | eval value=value."%" | table value

Now choose your visualization to be "single value".

View solution in original post

0 Karma

thirumalreddyb
Communicator
your query ...... | eval splits=split(value,".")  | eval count=mvcount(splits) | eval value=if(count>1,value,mvindex(splits,0)) | eval value=value."%" | table value

Now choose your visualization to be "single value".

0 Karma

gustavomichels
Path Finder

This works, but I just needed to round the value when the if for count > 1 is true.

Nice hack, transformed it into a string with the % sign 🙂

Thank you

0 Karma

sowjanyasama
New Member

Thank you, for number precision it is working fine, but the value is displayed black. I want to get colored values accordingly e.g: 0%-40% green, 40%-80% blue etc . Is it possible?
Can you help me with it.

0 Karma

renjith_nair
SplunkTrust
SplunkTrust

Sorry misunderstood your question. I will remove the answer so that the question stays back as unanswered.

Happy Splunking!
0 Karma

jplumsdaine22
Influencer

Interesting question. I don't know myself. Hopefully someone here can.

But as an aside do you need (or have!) that level of precision? ie 1/100,000th

0 Karma

gustavomichels
Path Finder

SLA numbers are usually up to 4 (or more) decimal places, and that's what the visualizations are for. I guess v1.1 in Splunk 6.2 used to leave integers as they were and round floats up to 4 decimal places as I didn't do any special treatment on rounding or whatnot.

It works the way it is, but it was nicer before.

0 Karma

jplumsdaine22
Influencer

Fair enough. 6 nines is pretty full on though. 84 ms a day of downtime!

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) v3.54.0

The Splunk Threat Research Team (STRT) recently released Enterprise Security Content Update (ESCU) v3.54.0 and ...

Using Machine Learning for Hunting Security Threats

WATCH NOW Seeing the exponential hike in global cyber threat spectrum, organizations are now striving more for ...

New Learning Videos on Topics Most Requested by You! Plus This Month’s New Splunk ...

Splunk Lantern is a customer success center that provides advice from Splunk experts on valuable data ...