Dashboards & Visualizations

Showing and hiding panel on value click

martynjlewis
Engager

Hi all

I am trying to create a hidden panel that shows when a value from a table is clicked but then stop showing when clicked again. I've added the existing test XML here. Could someone please help?

Thanks

 

<dashboard version="1">
  <label>DrillDown</label>
  <row>
    <panel>
      <table>
        <search>
          <query>index=_*|stats count by sourcetype</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <drilldown>
          <set token="tok_sourcetype">$click.value$</set>
          <set token="show_panel">true</set>
        </drilldown>
      </table>
    </panel>
  </row>
  <row>
    <panel depends="$show_panel$">
      <chart>
        <search>
          <query>index=_* sourcetype=$tok_sourcetype$|timechart count</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <option name="charting.chart">line</option>
        <option name="charting.drilldown">all</option>
        <drilldown>
          <unset token="show_panel"></unset>
        </drilldown>
      </chart>
    </panel>
  </row>
</dashboard>
Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
<dashboard version="1">
  <label>DrillDown</label>
  <row>
    <panel>
      <table>
        <search>
          <query>index=_*|stats count by sourcetype</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <drilldown>
          <set token="tok_sourcetype">$click.value$</set>
          <eval token="show_panel">if($show_panel$="true",null(),"true")</eval>
        </drilldown>
      </table>
    </panel>
  </row>
  <row>
    <panel depends="$show_panel$">
      <chart>
        <search>
          <query>index=_* sourcetype=$tok_sourcetype$|timechart count</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <option name="charting.chart">line</option>
        <option name="charting.drilldown">all</option>
      </chart>
    </panel>
  </row>
</dashboard>

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
<dashboard version="1">
  <label>DrillDown</label>
  <row>
    <panel>
      <table>
        <search>
          <query>index=_*|stats count by sourcetype</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <drilldown>
          <set token="tok_sourcetype">$click.value$</set>
          <eval token="show_panel">if($show_panel$="true",null(),"true")</eval>
        </drilldown>
      </table>
    </panel>
  </row>
  <row>
    <panel depends="$show_panel$">
      <chart>
        <search>
          <query>index=_* sourcetype=$tok_sourcetype$|timechart count</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <option name="charting.chart">line</option>
        <option name="charting.drilldown">all</option>
      </chart>
    </panel>
  </row>
</dashboard>

livehybrid
SplunkTrust
SplunkTrust

Hi @martynjlewis 

Just to clarify, what is it that you would click the second time in order to hide the panel?

You could have a "Reset" button or something at the top which could unset the token?

🌟 Did this answer help you? If so, please consider:

  • Adding karma to show it was useful
  • Marking it as the solution if it resolved your issue
  • Commenting if you need any clarification

Your feedback encourages the volunteers in this community to continue contributing

0 Karma
Get Updates on the Splunk Community!

.conf25 Community Recap

Hello Splunkers, And just like that, .conf25 is in the books! What an incredible few days — full of learning, ...

Splunk App Developers | .conf25 Recap & What’s Next

If you stopped by the Builder Bar at .conf25 this year, thank you! The retro tech beer garden vibes were ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...