Saturday, November 16, 2024
Google search engine
HomeLanguagesJavascriptD3.js pow.interpolate() Function

D3.js pow.interpolate() Function

The pow.interpolate() function is used to set the range interpolator factory which is used to create the interpolators for each pair of values from the adjacent ranges.

Syntax:

pow.interpolate(interpolate);

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

  • interpolator: This parameter accepts an interpolator.

Return Value: This function does not return anything.

Below examples illustrate the pow.interpolate() function in D3.js:

Example: Below given is a example of the function given mentioned above.




<!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=
    </script>
    <script src=
    </script>
    <script src=
    </script>
</head>
  
<body>
    <h2 style="color:green;">
        neveropen
    </h2>
  
    <p>D3.js pow.interpolate() Function</p>
  
    <script>
        var pow = d3.scalePow()
          
            // Domain ranges -10, 0, 10
            .domain([-10, 0, 10])
          
            // Range for the domain
            .range([10, 20, 30, 40, 50, 60, 70, 80, 90])
          
            // Using interpolateRound
            .interpolate(d3.interpolateRound);
  
        document.write("<h3>pow(1.0): " + pow(1.0) + "</h3>");
        document.write("<h3>pow(2.0): " + pow(2.0) + "</h3>");
        document.write("<h3>pow(3.5): " + pow(3.5) + "</h3>");
        document.write("<h3>pow(4.1): " + pow(4.1) + "</h3>");
        document.write("<h3>pow(1.3): " + pow(1.3) + "</h3>");
        document.write("<h3>pow(-1.5): " + pow(-2.5) + "</h3>");
    </script>
</body>
  
</html>


Output:

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments