Splunk Enterprise

Why is the background color is for my single value visualization not as expected?

x05311
Explorer

Expected background color is light blue but its showing with BLACK color.

0 Karma
1 Solution

adonio
Ultra Champion

The range assumes you have a numeric value, the eval statement converts your numeric value to a string and splunk falls on default (black)
new code:

<dashboard>
  <label>count</label>
  <row>
    <panel>
      <title>count 100</title>
      <single>
        <search>
          <query>index = _internal | head 100 | stats count | table count</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="colorMode">block</option>
        <option name="numberPrecision">0.00</option>
        <option name="rangeColors">["0x65a637","0x6db7c6","0xd93f3c"]</option>
        <option name="rangeValues">[0,100]</option>
        <option name="unit">%</option>
        <option name="useColors">1</option>
      </single>
    </panel>
  </row>
</dashboard>

screenshot:

alt text

View solution in original post

adonio
Ultra Champion

The range assumes you have a numeric value, the eval statement converts your numeric value to a string and splunk falls on default (black)
new code:

<dashboard>
  <label>count</label>
  <row>
    <panel>
      <title>count 100</title>
      <single>
        <search>
          <query>index = _internal | head 100 | stats count | table count</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="colorMode">block</option>
        <option name="numberPrecision">0.00</option>
        <option name="rangeColors">["0x65a637","0x6db7c6","0xd93f3c"]</option>
        <option name="rangeValues">[0,100]</option>
        <option name="unit">%</option>
        <option name="useColors">1</option>
      </single>
    </panel>
  </row>
</dashboard>

screenshot:

alt text

x05311
Explorer

Thank you Sir,
Thank you Sir,
Thank you Sir,

0 Karma

adonio
Ultra Champion

you are welcome!!!

0 Karma

adonio
Ultra Champion

hello there, looks like you dont have the range defined:
here is a sample code:

<dashboard>
  <label>count</label>
  <row>
    <panel>
      <title>count 100</title>
      <single>
        <search>
          <query>index = _internal | head 100 | stats count | table count</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="colorMode">block</option>
        <option name="rangeColors">["0x65a637","0x6db7c6","0xd93f3c"]</option>
        <option name="rangeValues">[0,100]</option>
        <option name="useColors">1</option>
      </single>
    </panel>
  </row>
</dashboard>

and some screenshots:
alt text

alt text

0 Karma

x05311
Explorer

Still it is showing Black color, in your code your are populating only count.

count

 <panel>
   <title>count 100</title>
   <single>
     <search>
       <query>index = _internal | head 100 | stats count AS cnt | eval per= (cnt+1)/9 | eval Percent =ROUND(per,2)."%"| table Percent</query>
       <earliest>-15m</earliest>
       <latest>now</latest>
       <sampleRatio>1</sampleRatio>
     </search>
     <option name="colorMode">block</option>
     <option name="rangeColors">["0x65a637","0x6db7c6","0xd93f3c"]</option>
     <option name="rangeValues">[0,100]</option>
     <option name="useColors">1</option>
   </single>
 </panel>
0 Karma

adonio
Ultra Champion

you can use these function in the gui editor to keep tour value numeric and not convert it to string by adding the percent symbol
click number format on the editor and add the precision you want and the unit you would like before and after.
adding code and screenshot in the next answer

0 Karma

x05311
Explorer
<panel>
  <single>
     <search>
      <query>index=index|eval conversion=((AAA_Error/Total_user)*100)|eval Percent =ROUND(conversion,2)."%"| table Percent</query>
      <earliest>0</earliest>
      <sampleRatio>1</sampleRatio>
    </search>
    <option name="colorMode">block</option>
    <option name="drilldown">none</option>
    <option name="rangeColors">["0x98AFC7","0x98AFC7","0x98AFC7"]</option>
    <option name="rangeValues">[0]</option>
    <option name="useColors">1</option>
  </single>
</panel>
0 Karma
Get Updates on the Splunk Community!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...