📜  D3.js interpolatePiYG()函数

📅  最后修改于: 2022-05-13 01:56:30.263000             🧑  作者: Mango

D3.js interpolatePiYG()函数

D3.js 中的d3.interpolatePiYG()函数是一种发散配色方案,可用作连续插值器,从 PiYG 发散配色方案返回相应的颜色。

句法:

d3.interpolatePiYG(t);

参数:此函数接受如上所述和下文所述的单个参数。

  • t:它是[0,1]范围内的数字。

返回值:此函数返回一个 RGB字符串。

下面给出了上面给出的函数的几个例子。

示例 1:

HTML


    
        
        
        D3.js interpolatePiYG() Function
    
    
    
        
        
        
        
        
    


HTML


    
        
        
        D3.js interpolatePiYG() Function
    
    
    
        D3.interpolatePiYG()
        
        
        
                             (0.1)                      
        
                             (0.2)                      
        
                             (0.3)                      
        
                             (0.4)                      
        
                             (0.5)                      
        
                             (0.6)                      
        
                             (0.7)                      
        
                             (0.8)                      
        
                             (0.9)                      
        
                             (1.0)                      
                                                          


输出:

示例 2:

HTML



    
        
        
        D3.js interpolatePiYG() Function
    
    
    
        D3.interpolatePiYG()
        
        
        
                             (0.1)                      
        
                             (0.2)                      
        
                             (0.3)                      
        
                             (0.4)                      
        
                             (0.5)                      
        
                             (0.6)                      
        
                             (0.7)                      
        
                             (0.8)                      
        
                             (0.9)                      
        
                             (1.0)                      
                                                          

输出: