D3.js scaleTime() Function Last Updated : 23 Aug, 2020 Comments Improve Suggest changes Like Article Like Report The d3.scaleTime() function is used to create and return a new time scale which have the particular domain and range. In this function the clamping is disabled by default. Syntax: d3.scaleTime([[domain, ]range]); Parameter: This function accepts two parameters as mentioned above and described below. Domain: It is an array of integers that defines the extent of domain values. If not specified then the default value is [2000-01-01, 2000-01-02]. Range: It is an array of integers or string. If not specified then the default value is [0, 1]. Return Value: This function returns a function. Example 1: HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" path1tent= "width=device-width,initial-scale=1.0"/> <script src="https://d3js.org/d3.v4.min.js"> </script> <script src="https://d3js.org/d3-color.v1.min.js"> </script> <script src= "https://d3js.org/d3-interpolate.v1.min.js"> </script> <script src= "https://d3js.org/d3-scale-chromatic.v1.min.js"> </script> </head> <body> <h2 style="color:green">Geeks for geeks</h2> <p>d3.scaleTime() Function</p> <script> var time = d3.scaleTime() .domain([1, 10]) .range([10, 5]); document.write("<h3>Type of d3.scaleTime() is: " + typeof (time) + "</h3>"); document.write("<h3>time(10): " + time(10) + "</h3>"); </script> </body> </html> Output: Example 2: HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" path1tent= "width=device-width, initial-scale=1.0"/> <script src="https://d3js.org/d3.v4.min.js"> </script> <script src="https://d3js.org/d3-color.v1.min.js"> </script> <script src= "https://d3js.org/d3-interpolate.v1.min.js"> </script> <script src= "https://d3js.org/d3-scale-chromatic.v1.min.js"> </script> </head> <body> <h2 style="color:green;">Geeks for geeks</h2> <p>d3.scaleTime() Function </p> <script> var time = d3.scaleTime() .domain([1, 10]) .range([1, 100]) document.write("<h3>time(1): " + time(1) + "</h3>") document.write("<h3>time(2): " + time(2) + "</h3>") document.write("<h3>time(3): " + time(3) + "</h3>") document.write("<h3>time(4): " + time(4) + "</h3>") </script> </body> </html> Output: Comment More infoAdvertise with us Next Article D3.js scaleTime() Function T tarun007 Follow Improve Article Tags : JavaScript Web Technologies D3.js Similar Reads D3.js scaleTime time() Function The time() function of d3.scaleTime() is used to return a value from and within the given range from the specified domain. Syntax: time(value) Parameter: This function accepts only one parameter as mentioned above and described below. value: This accepts a value from the specified domain. Return Val 1 min read D3.js scaleQuantize() Function The d3.scaleQuantize() function in d3.js is used to create a new scale that is similar to linear scales except that linear scales use a discrete and dis-continuous scale. Syntax: d3.scaleQuantize(); Parameters: This function does not accept any parameter. Return Value: A function is returned by d3.s 2 min read D3.js scaleQuantile() Function The d3.scaleQuantile() function in D3.js is used to create and return a new quantile scale that has the specified domain and range. In case the domain or the range is not specified, each value is set to empty array by default. Syntax: d3.scaleQuantile( domain, range ) Parameters: This function accep 2 min read D3.js zoom.scaleTo() Function The zoom.scaleTo() function in D3.js is used to scale the current zoon transform of the selected elements to k.Syntax:zoom.scaleTo(selection, k[, p])Parameters: This function accept two parameter as mentioned above and described belowselection: This parameter can be selection or transition.k: This p 2 min read D3.js scalePoint() Function The d3.scalepoint() function is used to create and return a new point scale with a particular domain and range, no rounding, no padding, and center alignment. Syntax: d3.scalePoint([[domain, ]range]); Parameters: This function takes two parameters as given above and described below: domain: It defin 2 min read Like