Dashboards & Visualizations

How to set the Timepicker in a dashboard from the drilldown of a timechart?

thisissplunk
Builder

Is there an easy way to pass the time range obtained from clicking on a bar in a timechart to the timepicker? I want all of my panels on the dashboard to reflect the timerange chosen by the timechart. They all use the timepicker so I figured this would be the easiest way to achieve this.

0 Karma
1 Solution

niketn
Legend

You can code Chart's drilldown event to populate selection earliest and latest values (if not it selects the search earliest and latest values).

  <drilldown>
    <set token="tok_earliest">$earliest$</set>
    <set token="tok_latest">$latest$</set>
  </drilldown>

PS: Your timechart should not be using global timepicker 🙂

Refer to http://docs.splunk.com/Documentation/Splunk/latest/Viz/Understandbasictableandchartdrilldownactions
and http://docs.splunk.com/Documentation/Splunk/latest/Viz/PanelreferenceforSimplifiedXML#Drilldown_even...

Also, check out selection chart event handler, where you can select a timerange in timechart and drill down will pick earliest and latest from the selection. http://docs.splunk.com/Documentation/Splunk/latest/Viz/PanelreferenceforSimplifiedXML#Drilldown_even...

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

View solution in original post

cmerriman
Super Champion

set the tokens using start and end
http://docs.splunk.com/Documentation/Splunk/latest/Viz/tokens#Define_tokens_for_pan_and_zoom_chart_c...

<selection>
    <set token="selection_earliest">$start$</set>
    <set token="selection_latest">$end$</set>
</selection>

thisissplunk
Builder

Thanks. niketnilay got to it a minute before you did.

0 Karma

niketn
Legend

You can code Chart's drilldown event to populate selection earliest and latest values (if not it selects the search earliest and latest values).

  <drilldown>
    <set token="tok_earliest">$earliest$</set>
    <set token="tok_latest">$latest$</set>
  </drilldown>

PS: Your timechart should not be using global timepicker 🙂

Refer to http://docs.splunk.com/Documentation/Splunk/latest/Viz/Understandbasictableandchartdrilldownactions
and http://docs.splunk.com/Documentation/Splunk/latest/Viz/PanelreferenceforSimplifiedXML#Drilldown_even...

Also, check out selection chart event handler, where you can select a timerange in timechart and drill down will pick earliest and latest from the selection. http://docs.splunk.com/Documentation/Splunk/latest/Viz/PanelreferenceforSimplifiedXML#Drilldown_even...

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

thisissplunk
Builder

Ok, so this grabs the time values, but how do I actually use it if I'm already using time.earliest and time.latest in my other panels? Is there a way to say "use this time instead now that you've clicked the timechart"?

0 Karma

cmerriman
Super Champion

in your other panels, use <earliest>$tok_earliest$</earliest>

0 Karma

thisissplunk
Builder

I need to use the global timepicker for my other panels as they all depend on that for a time range in the same way the timechart panel does. There's really no difference between them. If I use tok_earliest on all of my other panels, when I update my global timepicker, those won't get updated.

What I really want to do is update the global timepicker via the timechart. Any ideas?

Edit: A crappy solution I found was to reset time.earliest and time.latest via the timechart. This works, but kind of breaks the timepicker as it stops updating your dashboard when you try to use it after clicking the timechart: <set token="time.earliest">$earliest$</set>

0 Karma

niketn
Legend

@thisissplunk... You should not correlate global time picker and timechart earliest and latest time. You can use a timepicker for timechart with defaults set. If you are using 6.5 you can keep the time picker hidden unless required to override the timechart.
Then like I had mentioned, timechart should be providing you with your earliest and latest values. If you do not click on timechart the earliest and latest will be from your global time picker.

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

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...