D3.js scaleQuantize() Function Last Updated : 19 Aug, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report 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.scaleQuantize() 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" /> <title>Geeks for geeks</title> <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> <style> body { line-height: 5px; text-align: center; } h2 { color: green; } </style> </head> <body> <h2>Geeks for geeks</h2> <p>D3.scaleQuantize() Function </p> <script> var object = d3.scaleQuantize() .domain([0, 1]) .range(["less than 0.5", "greater than 0.5"]); document.write("<br/>") document.write("<h3>" + object(0.4) + "</h3>"); document.write("<h3>" + object(0.5) + "</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" /> <title>Geeks for geeks</title> <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> <style> body { line-height: 5px; text-align: center; } h2 { color: green; } </style> </head> <body> <h2>Geeks for geeks</h2> <p>D3.scaleQuantize() Function </p> <script> var object = d3.scaleQuantize() // Value from 1 to 10 decides // which value to output .domain([1, 10]) .range(["1. This is object(1)", "2. This is object(2)", "3. This is object(3)", "4. This is object(4)", "5. This is object(5)", "6. This is object(6)", "7. This is object(7)", "8. This is object(8)", "9. This is object(9)", "10. This is object(10)"]); document.write("<br/>") document.write("<h3>" + object(1) + "</h3>"); document.write("<h3>" + object(2) + "</h3>"); document.write("<h3>" + object(3) + "</h3>"); document.write("<h3>" + object(4) + "</h3>"); document.write("<h3>" + object(5) + "</h3>"); document.write("<h3>" + object(6) + "</h3>"); document.write("<h3>" + object(7) + "</h3>"); document.write("<h3>" + object(8) + "</h3>"); document.write("<h3>" + object(9) + "</h3>"); document.write("<h3>" + object(10) + "</h3>"); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article D3.js scaleQuantize() Function T tarun007 Follow Improve Article Tags : JavaScript Web Technologies D3.js Similar Reads 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 quantize() Function The d3.quantize function is used to generate uniformly spaced samples of interpolator and return them. It is useful in generating a particular number of samples from a given interpolator. Syntax: d3.quantize(interpolator, n); Parameters: It takes the following two parameters. interpolator: It is the 1 min read D3.js scaleTime() Function 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. 2 min read D3.js scaleQuantile quantile() Function 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. Syntax: quantile( value ) Parameters: This function accepts a single parameter as given above and described below: va 1 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