D3.js pow.domain() Function Last Updated : 23 Aug, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The pow.domain() function is used to set the scale’s domain to the specified array of numbers. The array specified here must contain two or more than two elements. Syntax: pow.domain([domain]); Parameters: This function takes a single parameter that is given above and described below. [domain]: An array that takes two or more values that specify the domain. Return Value: This function does not return any value. Example 1: 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> </head> <body> <script> var pow = d3.scalePow() // Setting domain for the scale. .domain([10, 20]) .range(["1", "2", "3", "4", "5"]) .exponent(2); console.log("The domain of this is [10,20]: "); console.log("pow(10): " + pow(10)); console.log("pow(11): " + pow(11)); console.log("pow(12): " + pow(12)); </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" /> <script src="https://d3js.org/d3.v4.min.js"> </script> </head> <style> </style> <body> <script> var pow = d3.scalePow() // Setting domain for the scale. .domain([-1, 1]) .range(["red", "blue", "green", "white"]) .exponent(2); console.log("The domain of this is [-1,1]: "); console.log("pow(-1): " + pow(-1)); console.log("pow(0): " + pow(0)); console.log("pow(1): " + pow(1)); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article D3.js log.domain() Function T tarun007 Follow Improve Article Tags : JavaScript Web Technologies D3.js Similar Reads D3.js log.domain() Function The log.domain() function is used to set the scaleâs domain to the specified array of numbers. The array specified here must contain two or more than two elements. By default, the domain is [1,10]. Syntax: log.domain([domain]); Parameters: This function accepts single parameter as mentioned above an 2 min read D3.js point.domain() Function The point.domain() function is used to set the domain of the point scale to a specified array of values. The first element in the array is mapped to the first point in the range, the second value in the domain to the second point, and so on. Syntax: point.domain([domain]); Parameters: This function 2 min read D3.js ordinal.domain() Function The ordinal.domain() function in d3.js is used to set the domain for the ordinal scale. In this first element of the domain is mapped to the first element of the range and the second element of the domain is mapped to second element of the range and so on. Syntax: ordinal.domain([domain]); Parameter 2 min read D3.js threshold.domain() Function The threshold.domain() function is used to set the domain of the threshold scale. The values given in this must be in non-descending order, if not then the behavior of the scale is undefined. Syntax: threshold.domain([domain]); Parameters: This function accepts a single parameter as given above and 2 min read D3.js band.domain() Function The band.domain() function in d3.js is used to set the domain of the scale. The first value that is present in the domain will be mapped to the first band in the range array and so on. Syntax: band.domain([domain]); Parameters: This function accepts single parameters as given above and described bel 2 min read D3.js pow.exponent() Function The pow.exponent() function is used to specify the exponent to the given value. It returns the current exponent when the exponent is not specified. The value of the current exponent defaults to one. Syntax: pow.exponent( exponent ) Parameters: This function accepts one parameter as mentioned above a 2 min read Like