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

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...