Dashboards & Visualizations

How to use rangemap in a "layout overlay" panel?

crazyeva
Contributor

According to app 'Splunk 6.x Dashboard Examples', dashboard 'Image Overlay with Single Values', it's cool to display a single value on an image, Picture: http://postimg.org/image/sjvjqy5vn/
But is it possible to define color range for result values?

I added the rangemap command to its search string:

<search id="merging_queue">
          <query>index=_internal earliest=-5m
              | stats count
              | rangemap field=count high=1000-1800 elevated=1801-2000 guarded=2001-2500 default=gray</query>
          <earliest>$earliest$</earliest>
          <latest>$latest$</latest>
          <preview>
            <set token="merging_queue">$result.count$</set>
          </preview>
      </search>

and add singlevalue color range definition to its css file:

.singleValue {
    font-size: 4em;
    font-weight: bold;
.singleValue .singleResult {
  font-size: 3em;
  vertical-align: -4px;
  margin: 0px 6px;
}
.singleValue .high .singleResult {
  color: #ff7e00;
}
.singleValue .elevated .singleResult {
  color: #ffb800;
}
.singleValue .guarded .singleResult {
  color: #4da6df;
}
#image_overlay_panel #merging_queue {
   position: absolute;
   top: 430px;
   left: 292px;
}

But it seems the <preview> element will not take rangemap value

0 Karma
1 Solution

crazyeva
Contributor

Still thanks to @ppablo_splunk, I will try not to mess up everything this time.
I found a solution myself.
in css file:

.singleValue {
    font-size: 1em;
    font-weight: bold;
}
.singleValue .green {
      font-size: 2em;
      color: #00ff00;
}
.singleValue .red {
      font-size: 6em;
      color: #ff0000;
}
.singleValue .blue {
      font-size: 4em;
      color: #0000ff;
}
#image_overlay_panel #parsing_queue {
   position: absolute;
   top: 430px;
   left: 292px;
}

in xml file:

      <search id="parsing_queue">
        <query>index=_internal
                  | stats count
                  | rangemap field=count green=0-50 blue=51-100 red=101-200 default=green
                  </query>
        <earliest>$earliest$</earliest>
        <latest>$latest$</latest>
      <preview>
          <set token="parsing_queue">$result.count$</set>
          <set token="parsing_range">$result.range$</set>
      </preview>
      </search>

and:

    <div class="singleValue">
        <div class="$parsing_range$" id="parsing_queue">$parsing_queue$</div>
    </div>

View solution in original post

0 Karma

crazyeva
Contributor

Still thanks to @ppablo_splunk, I will try not to mess up everything this time.
I found a solution myself.
in css file:

.singleValue {
    font-size: 1em;
    font-weight: bold;
}
.singleValue .green {
      font-size: 2em;
      color: #00ff00;
}
.singleValue .red {
      font-size: 6em;
      color: #ff0000;
}
.singleValue .blue {
      font-size: 4em;
      color: #0000ff;
}
#image_overlay_panel #parsing_queue {
   position: absolute;
   top: 430px;
   left: 292px;
}

in xml file:

      <search id="parsing_queue">
        <query>index=_internal
                  | stats count
                  | rangemap field=count green=0-50 blue=51-100 red=101-200 default=green
                  </query>
        <earliest>$earliest$</earliest>
        <latest>$latest$</latest>
      <preview>
          <set token="parsing_queue">$result.count$</set>
          <set token="parsing_range">$result.range$</set>
      </preview>
      </search>

and:

    <div class="singleValue">
        <div class="$parsing_range$" id="parsing_queue">$parsing_queue$</div>
    </div>
0 Karma

ppablo
Retired

no worries @crazyeva. I'm glad you found your own answer and shared it here for other users 🙂

0 Karma

crazyeva
Contributor

Thanks to @ppablo_splunk for your help, By another misoperation, I deleted your post about code editing suggestion. Could I reinstate it?

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, ...