Skip to content
Related Articles

Related Articles

Improve Article

D3.js scaleQuantile quantile() Function

  • Last Updated : 23 Aug, 2020
Geek Week

The quantile() function of d3.scaleQuantile() in D3.js is used to return a value from the range corresponding to the given input value. This input value lies in the specified domain.


quantile( value )

Parameters: This function accepts a single parameter as given above and described below:

  • value: It takes a numeric value that lies in the domain.

Return Values: This function return a value corresponding to the specified range.

The below program illustrates the quantile() function in D3.js:



<!DOCTYPE html>
    <script src="">
    <script src=
    <script src=
    <h1 style="color: green">GeeksforGeeks</h1>
    <p>d3.scaleQuantile | quantile() Function </p>
        var quantile = d3.scaleQuantile()
            // Setting domain and range
            // for the scale
            .domain([1, 10])
            .range([0, 960]);
        // Printing the output using the
        // quantile() function
            "<h3>" + quantile(1) + "</h3>");
            "<h3>" + quantile(5) + "</h3>");
            "<h3>" + quantile(9) + "</h3>");
            "<h3>" + quantile(10) + "</h3>");


Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it’s lowest price ever!

My Personal Notes arrow_drop_up
Recommended Articles
Page :