Related Articles

Related Articles

D3.js pow.copy() Function
  • Last Updated : 23 Aug, 2020

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 of the original scale.

Example 1:



html

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>
    <h2 style="color: green;">GeeksforGeeks</h2>
  
    <p>D3.js pow.copy() Function </p>
  
    <script>
        var pow = d3.scalePow()
            .domain([1, 10])
            .range([10, 20, 30, 40, 50, 60]);
              
        let powCopy = pow.copy();
  
        document.write("<h3>Original scale: " 
                + pow(2.5) + "</h3>");
  
        document.write("<h3>Copy scale: " 
                + powCopy(2.5) + "</h3>");
    </script>
</body>
  
</html>

chevron_right


Output:

Example 2:

html

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>
    <h2 style="color: green;">GeeksforGeeks</h2>
  
    <p>pow.copy() Function </p>
  
    <script>
        var pow = d3.scalePow()
            .domain([1, 10])
            .range([10, 20, 30, 40, 50, 60]);
  
        let powCopy = pow.copy();
  
        document.write("<h3>Original scale: " 
                + pow(2.5) + "</h3>");
  
        document.write("<h3>Copy scale: " 
                + powCopy(2.5) + "</h3>");
                  
        pow.exponent(2);
        document.write("<p> Changes in original "
            + "scale does not affect copy scale.</p>");
  
        document.write("<h3>Original scale: "
                    + pow(2.5) + "</h3>");
                      
        document.write("<h3>Copy scale: " 
                    + powCopy(2.5) + "</h3>");
    </script>
</body>
  
</html>

chevron_right


Output:

full-stack-img




My Personal Notes arrow_drop_up
Recommended Articles
Page :