當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


jQWidgets jqxBarGauge colorScheme屬性用法及代碼示例


jQWidgets 是一個 JavaScript 框架,用於為 PC 和移動設備製作基於 Web 的應用程序。它是一個非常強大和優化的框架,獨立於平台並得到廣泛支持。這個jqxBarGauge表示一個 jQuery 條形圖小部件,它為給定的值繪製條形圖。這裏的配色方案屬性用於設置條形儀表的配色方案。默認值為‘scheme01’。

用法:

$('.selector').jqxBarGauge({
    values:[array], 
    max:number,
    colorScheme:string
});

CDN 鏈接:從 https://www.jqwidgets.com/download/鏈接下載 jQWidgets。在 HTML 文件中,找到下載文件夾中的腳本文件:

<link rel=”stylesheet” href=”jqwidgets/styles/jqx.base.css” type=”text/css” />
<script type=”text/javascript” src=”scripts/jquery-1.11.1.min.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxdraw.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxbargauge.js”></script>



下麵是顯示實現的示例:

範例1:

HTML


<!DOCTYPE html>
<html lang="en">
  
<head>
    <link rel="stylesheet" 
          href="jqwidgets/styles/jqx.base.css"
          type="text/css"/>
    <script type="text/javascript" 
            src="scripts/jquery-1.11.1.min.js">
    </script>
    <script type="text/javascript"
            src="jqwidgets/jqxcore.js">
    </script>
    <script type="text/javascript" 
            src="jqwidgets/jqxdraw.js">
    </script>
    <script type="text/javascript" 
            src="jqwidgets/jqxbargauge.js">
    </script>
  
    <script type="text/javascript">
        $(document).ready(function ()
        {
            $('#gfg').jqxBarGauge({
                values:[100,105,110,115,120], max:140,
                colorScheme:'scheme07'
            });
        });
    </script>
</head>
<body>
        
    <h1 style="color:green;"> 
        GeeksforGeeks 
    </h1>
    <h3> 
        jQWidgets jqxBarGauge colorScheme property
    </h3>
  
    <div id="gfg"></div>
</body>
  
</html>

輸出:

範例2:

HTML


<!DOCTYPE html>
<html lang="en">
  
<head>
    <link rel="stylesheet" 
          href="jqwidgets/styles/jqx.base.css"
          type="text/css"/>
    <script type="text/javascript" 
            src="scripts/jquery-1.11.1.min.js">
    </script>
    <script type="text/javascript"
            src="jqwidgets/jqxcore.js">
    </script>
    <script type="text/javascript" 
            src="jqwidgets/jqxdraw.js">
    </script>
    <script type="text/javascript" 
            src="jqwidgets/jqxbargauge.js">
    </script>
  
    <script type="text/javascript">
        $(document).ready(function ()
        {
            $('#gfg').jqxBarGauge({
                values:[100,105,110,115,120], max:140,
                colorScheme:'scheme03'
            });
        });
    </script>
</head>
<body>
      <h1 style="color:green;"> 
        GeeksforGeeks 
    </h1>
    <h3> 
        jQWidgets jqxBarGauge colorScheme property
    </h3>
    <div id="gfg"></div>
</body>
  
</html>

輸出:

參考:https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxbargauge/jquery-bar-gauge-getting-started.htm




相關用法


注:本文由純淨天空篩選整理自taran910大神的英文原創作品 jQWidgets jqxBarGauge colorScheme Property。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。