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!

Where Innovation Takes Flight: The Splunk4Aviation Flight Sim Lands at .conf26

If you hear someone at .conf26 shouting "gear down, GEAR DOWN" across the show floor, you have found us.  The ...

Turn Cisco Telemetry Into Action with Cisco Data Fabric, powered by the Splunk ...

The surge in machine data is already hitting enterprise budgets, and the agentic era will only intensify it. ...

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...