D3.js pow.clamp() Function Last Updated : 28 Sep, 2021 Comments Improve Suggest changes Like Article Like Report The pow.clamp() function in d3.js is used to enable the clamp or disable the clamp only if the clamp is specified. The range of the return value may be outside the given range if the clamp is disabled. Syntax: pow.clamp(clamp); Property Values: This function accepts single parameter as given above and described below. clamp: It accepts a boolean value of true or false. Below given are a few examples of the function given above. Example1: When clamp is set to false. 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>pow.clamp() Function </p> <script> // Calling the .scalePow() function var x = d3.scalePow() .domain([10, 100]) .range([0, 5]) .clamp(false); // Calling pow() and .invert() function var a = x(2); var b = x.invert(15); document.write("<h3>"+a+"</h3>"); document.write("<h3>"+b+"</h3>"); </script> </script> </body> </html> Output: Example 2: When clamp is set to true. 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>pow.clamp() Function </p> <script> // Calling the .scalePow() function var x = d3.scalePow() .domain([10, 100]) .range([0, 5]) .clamp(true); // Calling pow() and .invert() function var a = x(12); var b = x.invert(15); var c = x.invert(150); document.write("<h3>"+a+"</h3>"); document.write("<h3>"+b+"</h3>"); document.write("<h3>"+c+"</h3>"); </script> </script> </body> </html> Output: Comment More infoAdvertise with us Next Article D3.js time.clamp() Function T tarun007 Follow Improve Article Tags : JavaScript D3.js Similar Reads D3.js log.clamp() Function The log.clamp() function is used to enable the clamp or disable the clamp. If the clamp is disabled then the range of the return value may be outside the given range through extrapolation. Syntax: log.clamp(clamp); Parameters: This function accepts single parameter as mentioned above and described b 2 min read D3.js pow.copy() Function The pow.copy() function is used to create and return an exact copy of the given scale. Any change in the original scale will not affect the return scale and vice-versa. Syntax: pow.copy(); Parameters: This function does not accept any parameters. Return Values: This function returns the exact copy o 2 min read D3.js time.clamp() Function The time.clamp() function in D3.js is used to enable or disable the clamp. If the clamp is disabled then the range of the return value may be outside the given range. Syntax: time.clamp( clamp ) Parameters: This function accepts only one parameter as given above and described below: clamp: It is a b 2 min read D3.js scalePow() Function The d3.scalePow() function is used to create and return a new continuous scale. This scale has a specified domain and range. Generally, it acts as a linear scale but when used with exponent it works in a different way. Syntax: d3.scalePow([[domain, ]range]); Parameters: This function accepts two par 2 min read D3.js pow.range() Function The pow.range() function in d3.js is used to set the scale's range to the specified array of values that must contain two or more than two values. The elements in the range can be number or string. Syntax: pow.range([range]); Parameters: This function takes a single parameter that is given above and 2 min read D3.js pow.ticks() Function The pow.ticks() function is used to return the count values from the scaleâs domain. The values returned by ticks() lies in the domain. If the count is not given as a parameter then by default it is set to 10. Syntax: pow.ticks([count]); Parameters: This function accepts a single parameter as mentio 2 min read Like