如果顏色可顯示,則使用D3.js中的color.displayable()函數返回true,否則返回false。
用法:
color.displayable()
參數:該函數不接受任何參數。
返回值:如果顏色可顯示,則此函數返回true,否則返回false。
以下示例程序旨在說明D3.js中的color.displayable()函數:
例:
<!DOCTYPE html> 
<html> 
  
<head> 
    <title> 
      color.displayable() function
  </title> 
  
    <script src= 
'https://d3js.org/d3.v4.min.js'> 
  </script> 
</head> 
  
<body> 
    <script> 
        // Calling the d3.color() function 
        // with some parameters 
        var color1 = d3.color("red"); 
        var color2 = d3.color("green"); 
        var color3 = d3.color("blue"); 
  
        // Calling the color.displayable() function 
        var A = color1.displayable(); 
        var B = color2.displayable(); 
        var C = color3.displayable(); 
  
        // Getting the value true or false 
        console.log(A); 
        console.log(B); 
        console.log(C); 
    </script> 
</body> 
  
</html>輸出:
true true true
參考: https://devdocs.io/d3~5/d3-color#color_displayable
相關用法
- p5.js tan()用法及代碼示例
 - p5.js second()用法及代碼示例
 - p5.js sin()用法及代碼示例
 - PHP cos( )用法及代碼示例
 - CSS var()用法及代碼示例
 - p5.js day()用法及代碼示例
 - PHP sin( )用法及代碼示例
 - PHP pos()用法及代碼示例
 - PHP key()用法及代碼示例
 - PHP abs()用法及代碼示例
 - PHP Ds\Map put()用法及代碼示例
 - d3.js d3.sum()用法及代碼示例
 
注:本文由純淨天空篩選整理自Kanchan_Ray大神的英文原創作品 D3.js | color.displayable() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
