Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

D3.js scaleTime time() Function

  • Last Updated : 26 Aug, 2020

The time() function of d3.scaleTime() is used to return a value from and within the given range from the specified domain.



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:



<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8" />
    <meta name="viewport" path1tent=
    <script src="">
    <script src=
    <script src=
    <script src=
    <h2 style="color:green;">Geeks for geeks</h2>
    <p>d3.scaleTime() | time() Function </p>
        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>")


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!