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
Legend

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!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...