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!

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...