Dashboards & Visualizations

How to enlarge the size of a caption underneath a singe-value visualization

horsefez
Motivator

Hi dashboard-pro's,

I have a question about formatting the text you are able to add underneath the value of a single-value visualization. Also called the "caption".
I want to make it bigger in size, however I didn't get it to work with CSS.
Please kindly show me a way how to do it. I know that it was possible in the past. I'm using splunk in version 7.2.3.

I've already found this post by the ever-great @niketnilay , but apparently that way doesn't work anymore.
https://answers.splunk.com/answers/513196/how-to-change-the-font-size-and-color-of-the-capti.html?ut...

Thanks in advance for your help!

Regards,
horsefez

1 Solution

vnravikumar
Champion

Hi @pyro_wood

Please try and let me know

<dashboard>
  <label>singlevalue</label>
  <row>
    <panel>
      <html>
       <style type="text/css">
       #test .under-label {
          font-size: 20px !important;
       }
       </style>
     </html>
      <single id="test">
        <search>
          <query>index=_internal | stats count as count</query>
          <earliest>$earliest$</earliest>
          <latest>$latest$</latest>
        </search>
        <option name="field">count</option>
        <option name="underLabel">Value</option>
      </single>
    </panel>
  </row>
</dashboard>

View solution in original post

niketn
Legend

@pyro_wood the > sign strictly looks for specified nodes arranged in the same hierarchy in the <html> DOM element. You can either remove the > signs or reduce to specific root and leaf nodes in the CSS selector as per your need, the example provided by @vnravikumar does the second.

First step is to add ID to Splunk element ie. at <row>, <panel> or specific view level like in the following example it is at <single> value level.

Second step is to right click an element and get the CSS selector for specifi destination node, in this case <text> with class under-label

7.2 has alot of changes in the way <html> components are created in the Splunk Dashboards. So do use Browser Inspector to investigate and ensure whether correct CSS Override is being applied or not: https://answers.splunk.com/answers/590387/how-do-i-update-panel-color-in-splunk-using-css-1.html

Following is the updated CSS style without > sign which should work.

  <row>
    <panel>
      <html>
        <style>
          #mySingleValue svg g.single-value-under-label g.single-value-label g.under-label-group g.svg-label text.under-label{
               font-size: 150% !important;
               fill: black !important;
               font-weight: bold !important;
           }          
        </style>
      </html>
      <single id="mySingleValue">
        <search>
          <query>| makeresults
          | fields - _time
          | eval data=100
          </query>
        </search>
        <option name="rangeColors">["0x53a051","0x0877a6","0xf8be34","0xf1813f","0xdc4e41"]</option>
        <option name="underLabel">Test Under Label</option>
      </single>
    </panel>
  </row>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

horsefez
Motivator

Thank you @niketnilay for that in-depth explanation. 🙂 🙂

0 Karma

vnravikumar
Champion

Hi @pyro_wood

Please try and let me know

<dashboard>
  <label>singlevalue</label>
  <row>
    <panel>
      <html>
       <style type="text/css">
       #test .under-label {
          font-size: 20px !important;
       }
       </style>
     </html>
      <single id="test">
        <search>
          <query>index=_internal | stats count as count</query>
          <earliest>$earliest$</earliest>
          <latest>$latest$</latest>
        </search>
        <option name="field">count</option>
        <option name="underLabel">Value</option>
      </single>
    </panel>
  </row>
</dashboard>

horsefez
Motivator

Thank you very much @vnravikumar

0 Karma

vnravikumar
Champion

Welcome 🙂

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...