D3.js timeout() Function Last Updated : 15 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The d3.timeout() function in D3.js is used to automatically stop the function or the timer after a particular interval of time. It works same as setTimeOut() function in JavaScript. Syntax: d3.timeout(callback, delay); Parameters: This function accepts two parameters as mentioned above and described below: callback: It is the function to be stopped after a particular delay.delay: It is the time after which the function will be stopped. Return Value: This function returns an object. Below given are a few examples of the above function. Example 1: When no delay is given. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content= "width=device-width, initial-scale=1.0"> </head> <body> <!-- Fetching from CDN of D3.js --> <script type="text/javascript" src="https://d3js.org/d3.v4.min.js"> </script> <script> let delay = 0 let func = function (e) { console.log(e); console.log("It will run one time" + " with delay equal ", delay); } var timer = d3.timeout(func, delay); func = function (e) { console.log(e); console.log( "It will run one time with no delay"); } var timer = d3.timeout(func); console.log("Return Type is: ", typeof timer); </script> </body> </html> Output: Example 2: When the delay is given. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content= "width=device-width, initial-scale=1.0"> </head> <body> <!-- Fetching from CDN of D3.js --> <script type="text/javascript" src="https://d3js.org/d3.v4.min.js"> </script> <script> let delay = 1000 let func = function (e) { console.log(e); console.log("It will run one time" + " with delay equal ", delay); } var timer = d3.timeout(func, delay); func = function (e) { console.log(e); console.log("This will be printed first"); } var timer = d3.timeout(func); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article D3.js | d3.timeMinute Function T tarun007 Follow Improve Article Tags : JavaScript Web Technologies D3.js Similar Reads D3.js | d3.timeMinute Function The d3.timeMinute function in D3.js is used to return all the time in minutes with date in the given range of start and end time. Syntax: d3.timeMinute.range( start, end, step ); Parameters: This function accept three parameters which are given below: Start: This parameter holds the given start time 2 min read D3.js | d3.timeMinutes() Function The d3.timeMinutes() function in D3.js is used to return all the time in minutes with the date in the given range of start and end time. Syntax: d3.timeMinutes( start, end, step ); Parameters: This function accept three parameters which are given below: Start: This parameter holds the given start ti 2 min read D3.js timer.stop() Function The timer.stop() function in D3.js is used to stop the current ongoing timer function thus preventing further calls to the function. This function will only work if the timer has not stopped yet. Syntax: timer.stop() Parameters: It takes no parameters. Returns: It does not return anything. Note: The 2 min read D3.js time.clamp() Function The time.clamp() function in D3.js is used to enable or disable the clamp. If the clamp is disabled then the range of the return value may be outside the given range. Syntax: time.clamp( clamp ) Parameters: This function accepts only one parameter as given above and described below: clamp: It is a b 2 min read D3.js | d3.timeDay() Function The d3.timeDay() function in D3.js is used to return date in "YYYY-MM-DD" format. Syntax: d3.timeDay(Date); Parameters: This function accepts a parameter "Date". Return Value: This function returns the given date in a specific format. Below programs illustrate the d3.timeDay() function in D3.js: Exa 1 min read D3.js queue() Function The d3.queue() function is used to create a queue of a specified size. If the size is not given by default it is taken as infinite. Syntax: d3.queue(size); Parameters: This function accepts a single parameter mentioned above and described below: size: It is the optional parameter if it is not given 2 min read Like