📜  D3.js interpolatePuRd()函数

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

D3.js interpolatePuRd()函数

D3.js 中的d3.interpolatePuRd()函数用于从“PuRd”顺序配色方案中返回特定颜色,该配色方案作为 RGB字符串返回。

句法:

d3.interpolatePuRd(t)

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

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

返回值:它返回一个 RGB字符串。

示例 1:

HTML


  

    
    
  
    D3.js interpolatePuRd() Function
    
    
    
    

  

    
        

GeeksForGeeks

           

D3.js interpolatePuRd() Function

                
  


HTML


  

    
    
  
    D3.js interpolatePuRd() Function
    
    
    
    
  
     

  

    
        

GeeksForGeeks

                

D3.js interpolatePuRd() Function

                   
                                D3.interpolatePuRd(0)                        
          
                                D3.interpolatePuRd(0.1)                         
          
                                D3.interpolatePuRd(0.2)                       
          
                                D3.interpolatePuRd(0.3)                         
          
                                D3.interpolatePuRd(0.4)                        
          
                                D3.interpolatePuRd(0.5)                         
          
                                D3.interpolatePuRd(0.6)                         
          
                                D3.interpolatePuRd(0.7)                        
          
                                D3.interpolatePuRd(0.8)                         
          
                                D3.interpolatePuRd(0.9)                         
          
                                D3.interpolatePuRd(1)                         
               
  


输出:

示例 2:

HTML



  

    
    
  
    D3.js interpolatePuRd() Function
    
    
    
    
  
     

  

    
        

GeeksForGeeks

                

D3.js interpolatePuRd() Function

                   
                                D3.interpolatePuRd(0)                        
          
                                D3.interpolatePuRd(0.1)                         
          
                                D3.interpolatePuRd(0.2)                       
          
                                D3.interpolatePuRd(0.3)                         
          
                                D3.interpolatePuRd(0.4)                        
          
                                D3.interpolatePuRd(0.5)                         
          
                                D3.interpolatePuRd(0.6)                         
          
                                D3.interpolatePuRd(0.7)                        
          
                                D3.interpolatePuRd(0.8)                         
          
                                D3.interpolatePuRd(0.9)                         
          
                                D3.interpolatePuRd(1)                         
               
  

输出: