Splunk Dev

Multiple Timeline graphs on a single webpage Javascript SDK

jenks22222
Engager

I am attempting to display multiple timeline graphs on the same webpage via the JavaScript SDK. The first graph shows up, but the second one does not. In firebug, I can see both jobs get created, but only div id timeline-container0 is populated by a timeline graph. I wasn't sure if I am overwriting a variable or there is some type of race condition going on..... any insight would be greatly appreciated.

Code:




How to start a Splunk session

<link href="/examples/browser/resources/bootstrap.css" rel="stylesheet">
<link href="/examples/browser/resources/prettify.css" type="text/css" rel="stylesheet" />
<link href="/examples/browser/resources/timeline.css" type="text/css" rel="stylesheet" />

<style type="text/css">

timeline-container0 {

height: 250px;
width: 500px;
}

timeline-container1 {

height: 250px;
width: 500px;
}





Timeline Graph 1




Timeline Graph 2





Tags (2)
0 Karma
1 Solution

jenks22222
Engager

Not sure if this is the best way to go about this ... but I got it to work by creating a second spunk.ui.timeline.js file and calling it in the second script which then generates the second timeline graph successfully.

Updated this line to point to the second version of spunk.ui.timeline:

var timelineToken = splunkjs.UI.loadTimeline("/client/splunk.ui.timeline2.js", function() {

View solution in original post

0 Karma

jenks22222
Engager

Not sure if this is the best way to go about this ... but I got it to work by creating a second spunk.ui.timeline.js file and calling it in the second script which then generates the second timeline graph successfully.

Updated this line to point to the second version of spunk.ui.timeline:

var timelineToken = splunkjs.UI.loadTimeline("/client/splunk.ui.timeline2.js", function() {

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...