Dashboards & Visualizations

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

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

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

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

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

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

SplunkTrust
SplunkTrust

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

0 Karma

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

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

Influencer

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

0 Karma