Dashboards & Visualizations

how to hide chart info before any selection on the dropdown box

chookp
Explorer

Hi i would like to check is there a way to hide my chart before i select my ASSET_NAME from the dropdown box, example the picture below is my initial startup dashboard but the chart on my right does not make sense only after i select any of my chart on the left then the right chart will make sense so my question is there a way to mask of the initial search? 

if ASSET_NAME : ALL is selected my chart on the right should be blank .

problem 1.JPG, if there is other selection it will show the result problem 2.JPG

thanks

Labels (2)
0 Karma

niketn
Legend

@chookp add the following to your dropdown change event handler to set/unset showPanel2 token and use the token as depends attribute for Panel 2 <panel> as well as <search>

        <change>
          <condition label="All">
            <unset token="showPanel2"></unset>
          </condition>
          <condition>
            <set token="showPanel2">true</set>
          </condition>
        </change>

 

    <panel depends="$showPanel2$">
      <table>
        <title>Panel 2</title>
        <search depends="$showPanel2$">

Following is a run anywhere dashboard example based on the details provided for you to try and confirm!

<form>
  <label>Hide Show panel based on Dropdown value</label>
  <fieldset submitButton="false"></fieldset>
  <row>
    <panel>
      <input type="dropdown" token="ASSET_NAME" searchWhenChanged="true">
        <label>ASSET_NAME</label>
        <choice value="*">All</choice>
        <choice value="a">Alpha</choice>
        <choice value="b">Beta</choice>
        <choice value="c">Charlie</choice>
        <default>*</default>
        <change>
          <condition label="All">
            <unset token="showPanel2"></unset>
          </condition>
          <condition>
            <set token="showPanel2">true</set>
          </condition>
        </change>
      </input>
    </panel>
    <panel>
      <!-- EMPTY PANEL TO ALIGN INPUT PANEL WITH PANEL1 and PANEL2 below -->
    </panel>
  </row>
  <row>
    <panel>
      <table>
        <title>Panel 1</title>
        <search>
          <query>| makeresults
| eval selectedValue="$ASSET_NAME$"</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </table>
    </panel>
    <panel depends="$showPanel2$">
      <table>
        <title>Panel 2</title>
        <search depends="$showPanel2$">
          <query>| makeresults 
| eval showPanel2="$showPanel2$"</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </table>
    </panel>
  </row>
</form>

 

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

bowesmana
SplunkTrust
SplunkTrust

Just add the following to the XML in the panel definition for the one you want to hide

<panel depends="$ASSET_NAME$">

 The the XML ref guide for the depends attribute

https://docs.splunk.com/Documentation/Splunk/8.0.4/Viz/PanelreferenceforSimplifiedXML#panel

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...