Dashboards & Visualizations

How to add upper and lower boundaries to a sparkline?

Dohrendorf_Cons
Path Finder

I am using a sparkline to display a bar-graph in my search results, the values displayed are percentage values, however due to the default behaviour of sparklines in splunk, a constant value of 100 is shown as a 0 line since there are no changes by which to determine the range. Is there any way to set fixed upper and lower boundaries for a sparkline?

Attached picture illustrates problem:

100 next to seemingly zero value

I tried this sort of thing:

 <format field="Verlauf" type="sparkline">
      <option name="type">bar</option>
      <option name="min">0</option>
      <option name="max">100</option>
 </format>

doesn't work though 😞

1 Solution

Dohrendorf_Cons
Path Finder

So I finally figured it out... There is an option to set the chartRange, that is not listed in Splunks documentation but works anyways.

chartRangeMin/chartRangeMax

<format field="Verlauf" type="sparkline">
      <option name="type">bar</option>
      <option name="chartRangeMin">0</option>
      <option name="chartRangeMax">100</option>
</format>

Just in case anybody else runs into this.

View solution in original post

Dohrendorf_Cons
Path Finder

So I finally figured it out... There is an option to set the chartRange, that is not listed in Splunks documentation but works anyways.

chartRangeMin/chartRangeMax

<format field="Verlauf" type="sparkline">
      <option name="type">bar</option>
      <option name="chartRangeMin">0</option>
      <option name="chartRangeMax">100</option>
</format>

Just in case anybody else runs into this.

frobinson_splun
Splunk Employee
Splunk Employee

Hi, @Dohrendorf_Consist,
Thanks for your notes and example. As a follow-up to you and anyone else who finds this post, I wanted to let you know that I've added the two configuration options to our documentation.

http://docs.splunk.com/Documentation/Splunk/6.4.1/Viz/PanelreferenceforSimplifiedXML#Common_options

Thanks!

the0duke0
Path Finder

Is there anyway to specify the same range when using the sparkline function in a search? We are embedding the report, so I can't use a dashboard. Thanks!

0 Karma

MuS
SplunkTrust
SplunkTrust

Hi Dohrendorf_Consist,

take a look at the dashboard examples app https://splunkbase.splunk.com/app/1603/ where you can find exactly this example - sorry I don't have it handy right now.

cheers, MuS

0 Karma

Dohrendorf_Cons
Path Finder

Actually I already looked at the examples, and yes there are nice ones for sparklines... However I can't find one that does anything with the sparklines boundaries. There is one in there, that uses JS to create a single progress-bar-like indicator, which is not what I am looking for.

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...