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 Value: This function returns a value from the range.
Below example illustrates the scaleTime time() function in D3.js:
Example:
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" path1tent= "width=device-width,initial-scale=1.0"/> </script> <script src= </script> <script src= </script> <script src= </script> </head> <body> <h2 style="color:green;">Geeks for neveropen</h2> <p>d3.scaleTime() | time() Function </p> <script> var time = d3.scaleTime() .domain([1, 100]) .range([1, 100]) document.write("<h3>The value of time(10): " + time(10) + "</h3>") document.write("<h3>The value of time(20): " + time(20) + "</h3>") document.write("<h3>The value of time(30): " + time(30) + "</h3>") document.write("<h3>The value of time(40): " + time(40) + "</h3>") </script> </body> </html> |
Output:


… [Trackback]
[…] Information on that Topic: geeksforgeeks.org/d3-js-scaletime-time-function-2/ […]
… [Trackback]
[…] Read More Info here to that Topic: geeksforgeeks.org/d3-js-scaletime-time-function-2/ […]
… [Trackback]
[…] Find More on on that Topic: geeksforgeeks.org/d3-js-scaletime-time-function-2/ […]
… [Trackback]
[…] Find More Information here on that Topic: geeksforgeeks.org/d3-js-scaletime-time-function-2/ […]