Dashboards & Visualizations

help for coloring a sIngle panel value in CSS

jip31
Motivator

hi

In my xml file, I use this code in order to format a single panel and to color the font in green but id doesnt works
could you help me please??

         #test4 .svg-container{
        background-color:;
        }

        #test4 .single-result{
        fill: rgb(255,0,0)!important;
        font-size: 30px !important;
        font-style:;
        font-color:green;!important;
        font-family:Arial;!important;vertical-align:middle;
        }

        #test4 .under-label {
           font-size: 30px !important;
          fill: rgb(255,255,255)!important;
        }

row>
    <panel>
      <title>Online machines</title>
      <single id="test4">
        <title>Source : Windows Host Monitor - Data collection frequency : 1 hour</title>
        <search>
          <query>[| inputlookup host.csv 
    | table host] `OnOff` 
| stats latest(_time) as _time by host 
| eval DiffInSeconds = (now() - _time) 
| eval DiffInMinutes=DiffInSeconds/60 
| eval Status=if(DiffInSeconds<3601, "Online", "Offline") 
| eval EventCreatedTime=strftime(_time,"%d-%b-%Y %H:%M:%S %p %Z" ) 
| table host EventCreatedTime DiffInMinutes Status 
| sort +EventCreatedTime 
| dedup host 
| eval Code = if(like(Status,"Online"), "Online", "Offline") 
| lookup lookup_cmdb_fo_all.csv HOSTNAME as host output SITE 
| search SITE=$tok_filtersite|s$ 
| stats dc(host) AS OnlineCount by Code 
| appendcols 
    [| inputlookup host.csv 
    | lookup lookup_cmdb_fo_all.csv HOSTNAME as host output SITE 
    | search SITE=$tok_filtersite|s$ 
    | stats count as NbIndHost] 
| where Code = "Online" 
| fields OnlineCount NbIndHost 
| eval OnlineCount = if(OnlineCount> 0, tostring(OnlineCount), "")  + " / " + NbIndHost + " machines " 
| fields - NbIndHost</query>
          <earliest>-60m@m</earliest>
          <latest>now</latest>
        </search>
        <option name="colorMode">none</option>
        <option name="drilldown">all</option>
        <option name="rangeColors">["0x65a637","0xd93f3c"]</option>
        <option name="rangeValues">[0]</option>
        <option name="refresh.display">progressbar</option>
        <option name="useColors">0</option>

      </single>
    </panel>
Tags (1)
0 Karma
1 Solution

niketn
Legend

@jip31 for Single Value Color you should provide the same through Single value Simple XML configuration and not CSS. If you need to do so, you would also need to add Simple XML JS extension to use Splunk JS stack and apply color only after Single Value is rendered.

Refer to one of my older answers with run anywhere example: https://answers.splunk.com/answers/583539/can-we-set-two-different-colors-for-single-value-a.html

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

View solution in original post

0 Karma

niketn
Legend

@jip31 for Single Value Color you should provide the same through Single value Simple XML configuration and not CSS. If you need to do so, you would also need to add Simple XML JS extension to use Splunk JS stack and apply color only after Single Value is rendered.

Refer to one of my older answers with run anywhere example: https://answers.splunk.com/answers/583539/can-we-set-two-different-colors-for-single-value-a.html

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

jip31
Motivator

many thanks to you

Get Updates on the Splunk Community!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...