Wednesday, September 25, 2024
Google search engine
HomeLanguagesJavascriptD3.js interpolateViridis() Function

D3.js interpolateViridis() Function

The d3.interpolateViridis() function in D3.js is used to return a particular color from the “viridis” sequential color scheme which is returned as an RGB string.

Syntax:

d3.interpolateViridis(t)

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

  • t: “t” is a number in a range [0, 1]

Return Values: It returns an RGB string.

Below given are a few examples of the function given above.

Example1:




<!DOCTYPE html> 
<html lang="en"
<head
    <meta charset="UTF-8" /> 
    <meta name="viewport"
        path1tent="width=device-width,  
        initial-scale=1.0"/> 
          
    <title>D3.js interpolateViridis() Function</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
</head
<body
    <center>
    <h1 style="color:green;">GeeksForGeeks</h1>
      
    <h3>D3.js interpolateViridis() Function</h3>
      
    <script
        document.write(d3.interpolateViridis(0)+"<br>"); 
        document.write(d3.interpolateViridis(0.1)+"<br>");
        document.write(d3.interpolateViridis(0.2)+"<br>");
        document.write(d3.interpolateViridis(0.3)+"<br>");
        document.write(d3.interpolateViridis(0.4)+"<br>");
        document.write(d3.interpolateViridis(0.5)+"<br>");
        document.write(d3.interpolateViridis(0.6)+"<br>");
        document.write(d3.interpolateViridis(0.7)+"<br>");
        document.write(d3.interpolateViridis(0.8)+"<br>");
        document.write(d3.interpolateViridis(0.9)+"<br>");
        document.write(d3.interpolateViridis(1));
    </script
    </center>
</body
</html>


[tabbyending

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments