Getting the slider current value

Hey guys, first time posting here so be easy with me :slight_smile: . So i have this plotly graph

and i need to be able to get the slider current value ( the time ) and pass it to another javascript function. I searched and found out that there isn’t any specific event for the slider so i’m wondering what are the alternatives.

After digging through the source code, I found the answer to this question - the ‘plotly_sliderend’ event:

// The div container holding your Plotly chart
let container = document.getElementById('graphDiv');

container.on(‘plotly_sliderend', function(data) {
// If you have multiple sliders, this event is triggered by all of them: can give the sliders a ‘name’ property
// to distinguish them
            if (data.slider.name === 'Threshold') {
                alert(data.step.value);
            }
          });

If you call newPlot() again on the same <div> the event is lost, so has to be redeclared. See plotly.js/draw.js at 6c5d30ffa7c2574f9a079844e32cb3dd87af9000 · plotly/plotly.js · GitHub for the event object’s structure.