Splunk Search

How do you fix the font size of each single value display panel?

shishirkumar
Engager

alt text

How do I fix the font size of each panel as in this i have used single value display with concatenate option but as per data size is increasing decreasing of font.

Attached image for reference.

Tags (2)
0 Karma

sdchakraborty
Contributor

Hi,

Please try the below code. Please note that Splunk is doing auto resize to fit those three single values inside panels. If you use fixed size you need to choose a font size that all those three values fit inside.

<dashboard>
  <label>Sid</label>
  <row>
    <panel>
      <html>
         <style>
           #MonthlyActivityReport .single-value .single-result {
             font-size: 20px !important;
           }
         </style>
       </html>
      <single id="MonthlyActivityReport">
        <search>
          <query>|  makeresults
| eval MonthlyActivityReport = 2371
| eval MonthlyActivityReport_formatted = "MonthlyActivityReport"." - ".MonthlyActivityReport
| table MonthlyActivityReport_formatted</query>
          <earliest>0</earliest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="colorBy">value</option>
        <option name="colorMode">none</option>
        <option name="drilldown">none</option>
        <option name="numberPrecision">0</option>
        <option name="rangeColors">["0x53a051", "0x0877a6", "0xf8be34", "0xf1813f", "0xdc4e41"]</option>
        <option name="rangeValues">[0,30,70,100]</option>
        <option name="showSparkline">1</option>
        <option name="showTrendIndicator">1</option>
        <option name="trellis.enabled">0</option>
        <option name="trellis.scales.shared">1</option>
        <option name="trellis.size">medium</option>
        <option name="trendColorInterpretation">standard</option>
        <option name="trendDisplayMode">absolute</option>
        <option name="unitPosition">after</option>
        <option name="useColors">0</option>
        <option name="useThousandSeparators">1</option>
      </single>
    </panel>
    <panel>
      <html>
         <style>
           #mmanolis .single-value .single-result {
             font-size: 20px !important;
           }
         </style>
       </html>
      <single id="mmanolis">
        <search>
          <query>|  makeresults
| eval mmanolis = 2063
| eval mmanolis_formatted = "mmanolis"." - ".mmanolis
| table mmanolis_formatted</query>
          <earliest>0</earliest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="colorBy">value</option>
        <option name="colorMode">none</option>
        <option name="drilldown">none</option>
        <option name="numberPrecision">0</option>
        <option name="rangeColors">["0x53a051", "0x0877a6", "0xf8be34", "0xf1813f", "0xdc4e41"]</option>
        <option name="rangeValues">[0,30,70,100]</option>
        <option name="showSparkline">1</option>
        <option name="showTrendIndicator">1</option>
        <option name="trellis.enabled">0</option>
        <option name="trellis.scales.shared">1</option>
        <option name="trellis.size">medium</option>
        <option name="trendColorInterpretation">standard</option>
        <option name="trendDisplayMode">absolute</option>
        <option name="unitPosition">after</option>
        <option name="useColors">0</option>
        <option name="useThousandSeparators">1</option>
      </single>
    </panel>
    <panel>
      <html>
         <style>
           #Cambia .single-value .single-result {
             font-size: 20px !important;
           }
         </style>
       </html>
      <single id="Cambia">
        <search>
          <query>|  makeresults
| eval Cambia = 2371
| eval Cambia_formatted = "Cambia"." - ".Cambia
| table Cambia_formatted</query>
          <earliest>0</earliest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="colorBy">value</option>
        <option name="colorMode">none</option>
        <option name="drilldown">none</option>
        <option name="numberPrecision">0</option>
        <option name="rangeColors">["0x53a051", "0x0877a6", "0xf8be34", "0xf1813f", "0xdc4e41"]</option>
        <option name="rangeValues">[0,30,70,100]</option>
        <option name="showSparkline">1</option>
        <option name="showTrendIndicator">1</option>
        <option name="trellis.enabled">0</option>
        <option name="trellis.scales.shared">1</option>
        <option name="trellis.size">medium</option>
        <option name="trendColorInterpretation">standard</option>
        <option name="trendDisplayMode">absolute</option>
        <option name="unitPosition">after</option>
        <option name="useColors">0</option>
        <option name="useThousandSeparators">1</option>
      </single>
    </panel>
  </row>
</dashboard>

niketn
Legend

@sdchakraborty the style sections can be at one place in any one of <html> panels. Also it would be better to hide the html panel used for CSS style override as it will add blank space inside the panel.

@shishirkumar couple of point:
1) Single value panel adjusts font size depending on the length of data being displayed. So, if you use CSS override you will end up hard-coding the size.
2) Seems like first part of your single value is fixed text and also causes Single Value data to be long. It would better suit as Title or part of Caption since that would be static.
3) Multiple <single> value visualizations within same panel will not have gaps between them. So try that out as well.

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

sdchakraborty
Contributor

Agree with you @niketnilay

0 Karma

shishirkumar
Engager

how to do XML itself rather then CSS files ?

0 Karma
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...