Dashboards & Visualizations

Get values from options visalizations

New Member

Hi all

I'm new in Splunk and I would like to know if it's possible to get the values set in an visalization option. For example, in a Single Value visualization I set the color and range in the option panel, and I see these values in the XML as follows:

    <option name="rangeColors">["0x53a051","0xf8be34","0xdc4e41","0xdc4e41"]</option>
    <option name="rangeValues">[95,100,120]</option>

Is it possible to get the values in the arrays so I can use them in a token somewhere else in my dashboard?


0 Karma


@mark8awar following could be some of your options:

Option 1. Use Splunk JS Extension to assign arrays as token include the JS file your dashboards and then use the tokens in your Dashboard to set chart configurations.
Option 2. Push the JS code for above mentioned approach, to dashboard.js, so that every dashboards in your app will already have the JS file included by default and you just need to use the token to set the Chart configurations as per your needs.
Option 3. Create a pre-built Panel with an independent search to set the token/s as per your need. Include the pre-built panel to your dashboards so that tokens can be used for Chart configuration.
Option 4. Add an init section in each dashboard to set the required arrays as tokens to be used in your dashboards.

Option 1, requires a new JS file to be created and included in all your dadhboards.
Option 2, does not need dashboard.js to be explicitly included all your dashboard, but you must ensure that your code does not break or lead to performance issues in your existing app (all other dashboards).
Option 3, does not require JS approach however, you must ensure prebuilt-panel is hidden as it does not have any UI component. It is just used to set initialization tokens, through one point of configuration.
Option 4. will require init section to be manually created/updated/deleted for each dashboard in case your threshold changes.

Please weigh in your option and you should be able to find all 4 approach in Splunk Docs and Splunk Answers.

| makeresults | eval message= "Happy Splunking!!!"
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, ...