Deployment Architecture

In single-value: CSS by value impossible

secuc2r83
Path Finder

Hello,

In a simple XML: i use a single value and i need , with a CSS, to change parameters by value (ex: if test1 => color=green, backgroung=red....)
But impossible to apply css by value (can't use token in single value)
I check "Splunk Dashboard Example 6x" but they do it by panel, never by single-value
I check parameters in Firefox's dev tools, but all my tests failed

Ex:

<panel>
      <single id="my_single">
       <search>
          <query>| stats count as value | eval value = 4550 | rangemap field=value test1=0-99 test2=100-999 test3=1000-2999</query>
        </search>
        <option name="field">range</option>
        <option name="colorBy">trend</option>
        <option name="colorMode">block</option>
        <option name="rangeColors">["0x65a637","0x6db7c6","0xf7bc38","0xf58f39","0xd93f3c"]</option>
        <option name="trendColorInterpretation">standard</option>
        <option name="trendDisplayMode">absolute</option>
      </single>
    </panel>

Test successfull:

#my_single .single-result {
font-size: 75px !important;
background-color: blue !important;
}

Tests failed when i try by value:

#my_single .test1.single-result.text {
font-size: 75px !important;
background-color: blue !important;
}

#my_single .single-result.text.test1 {
font-size: 75px !important;
background-color: blue !important;
}

#my_single .single-result.text.value.test1 {
font-size: 75px !important;
background-color: blue !important;
}


#my_single .single-result.text.value-test1 {
font-size: 75px !important;
background-color: blue !important;
}

#my_single .single-result.text-test1 {
font-size: 75px !important;
background-color: blue !important;
}

.test1.single-result-value {
font-size: 75px !important;
background-color: blue !important;
}

#my_single .test1.single-result.text-value {
font-size: 75px !important;
background-color: blue !important;
}

Thanks for your help

Tags (1)
0 Karma
1 Solution

niketn
Legend

@secuc2r83 when Single Value is Rendered CSS override will not work. You might have to try with Simple XML JS Extension. Please refer to the one of my older answer on Similar lines: https://answers.splunk.com/answers/583539/can-we-set-two-different-colors-for-single-value-a.html

Adjust to your needs and if you need further help, let us know 🙂

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

View solution in original post

0 Karma

secuc2r83
Path Finder

Hi niketnilay,

I successfully adapt your script to use it with strings.

Thanks for your helps
Regards

niketn
Legend

@secuc2r83 when Single Value is Rendered CSS override will not work. You might have to try with Simple XML JS Extension. Please refer to the one of my older answer on Similar lines: https://answers.splunk.com/answers/583539/can-we-set-two-different-colors-for-single-value-a.html

Adjust to your needs and if you need further help, let us know 🙂

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
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!

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...

Global Splunk User Group Events: May + June 2026

Your Splunk Community Awaits: Discover Upcoming User Group Events Worldwide    Staying ahead in the fast-paced ...