Black Lives Matter. Please consider donating to Black Girls Code today.

Stop streaming functionality

I was wondering whether it is possible to stop Plotly.extendTraces and keep the graphs intact with the last streamed data on the graphs? I am streaming data from a python server at the moment, and I want a way to stop data from being plotted on the streaming graph by a button click.


plotGraph('Dashboard', data, layout);

var cnt = 0;

var interval = setInterval(function () {

	var update = {
		x: [
		y: [
	Plotly.extendTraces('Dashboard', update, [0, 1, 2, 3, 4, 5], 100);
	Plotly.relayout('Dashboard', 'xaxis.autorange', true);
	if (cnt === 100) clearInterval(interval);
}, 50);

Plotly doesn’t provide an easy way to do this, but calling clearInterval(interval); will effectively stop your streaming calls.

1 Like