jQWidgets jqxGauge LinearGauge showRanges属性

  • Post category:jquery

jQWidgets jqxGauge LinearGauge showRanges属性

jQWidgets是一个基于jQuery的UI组件库,提供了丰富的UI组件和工具,包括表格、表、日历、菜单等。jqxGaugejqxLinearGaugejQWidgets中的两个组件,用于显示仪表盘和线性仪盘。这两个组件都提供了showRanges属性用于控制是否显示范围。

showRanges属性的基本语法

showRanges属性用于控制是否显示范围。其基本语法如下:

// 设置仪表盘是否显示范围
$('#jqxGauge').jqxGauge({
  showRanges: true
});

// 设置性仪表盘是否显示范围
$('#jqxLinearGauge').jqxLinearGauge({
  showRanges: true
});

jqxGaugejqxLinearGauge组件中,可以使用showRanges属性来控制是否显示范围。

示例1:设置jqxGauge是否显示范围

以下是一个示例,演示如何使用showRanges属性设置jqxGauge是否显示范围:

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>jQWidgets Gauge Example</title>
  <link rel="stylesheet" href="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/styles/jqx.base.css">
  <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  <script src="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/jqxcore.js"></script>
  <script src="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/jqxdata.js"></script>
  <script src="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/jqxbuttons.js"></script>
  <script src="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/jqxgauge.js"></>
</head>
<body>
  <div id="jqxGauge"></div>
  <script>
    $(document).ready(function () {
      $('#jqxGauge').jqxGauge({
        showRanges: true,
        value: 75,
        pointer: {
          length: '60%',
          width: 10,
          style: { fill: '#000000' },
          position: { x: 55, y: 200 }
        }
      });
    });
  </script>
</body>
</html>

在这个示例中,我们使用jqxGauge组件创建了一个仪表盘,并使用showRanges属性设置了是否显示范围为true`。

示例2:设置jqxLinearGauge是否显示范围

以下是另一个示例,演示如何使用showRanges属性设置jqxLinearGauge是否显示范围:

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>jQWidgets LinearGauge Example</title>
  <link rel="stylesheet" href="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/styles/jqx.base.css">
  <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  <script src="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/jqxcore.js"></script>
  <script srchttps://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/jqxdata.js"></script>
  <script src="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/jqxbuttons.js"></script>
  <script src="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/jqxlineargauge.js"></script>
</head>
<body>
  <div id="jqxLinearGauge"></div>
  <script>
    $(document).ready(function () {
      $('#jqxLinearGauge').jqxLinearGauge({
        showRanges: true,
        max: 100,
        min: 0,
        value: 75,
        pointer: {
          type: 'arrow',
          size: '5%',
          style: { fill: '#000000' },
          position: '50%'
        }
      });
    });
  </script>
</body>
</html>

在这个示例中,我们使用jqxLinearGauge组件创建了一个线性仪表盘,并使用showRanges属性设置了是否显示范围为true

综上所述,jqxGaugejqxLinearGauge组件都提供了showRanges属性,用于控制是否显示范围。本文详细介绍了showRanges属性的使用和示例。

参考

jQWidgets jqxGauge LinearGauge scaleStyle属性

jQWidgets是一个基于jQuery的UI组件库,提供了丰富UI组件和工具,包括表格、图表、日历、菜单等。jqxGaugejqxLinearaugejQWidgets中的两个组件,用于显示仪表盘和线性仪。这两组件都提供了scaleStyle属性用于设置刻度线的样式。

scaleStyle属性的基本语法

scaleStyle属性用于设置刻度线的样式。其基本语法如下:

// 设置仪表盘刻度线样式$('#jqxGauge').jqxGauge({
  ticksMajor: { size: '10%', interval: 10, style: { 'stroke-width': 2, stroke: '#aaaaaa' } },
  ticksMinor: { size: '5%', interval: 2.5, style: { 'stroke-width': 1, stroke: '#aaaaaa' } },
  scaleStyle: { stroke: '#aaaaaa', 'stroke-width': 1 }
});

// 设置线性仪表盘刻度线样式
$('#jqxLinearGauge').jqxLinearGauge({
  ticksMajor: { size: '10%', interval: 10, style: { 'stroke-width': 2, stroke: '#aaaaaa' } },
  ticksMinor: { size: '5%', interval: 2.5, style: { 'stroke-width': 1, stroke: '#aaaaaa' } },
  scaleStyle: { stroke: '#aaaaaa', 'stroke-width': 1 }
});

jqxGaugejqxLinearGauge组件中,可以使用scaleStyle属性来设置刻度线的样式。

示例1:设置jqxGauge刻度线样式

以下是一个示例,演示如何使用scaleStyle属性设置jqxGauge的刻度线样式:

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>jQWidgets Gauge Example</title>
  <link rel="stylesheet" href="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/styles/jqx.base.css">
  <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  <script src="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/jqxcore.js"></script>
  <script src="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/jqxdata.js"></script>
  <script src="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/jqxbuttons.js"></script>
  <script src="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/jqxgauge.js"></>
</head>
<body>
  <div id="jqxGauge"></div>
  <script>
    $(document).ready(function () {
      $('#jqxGauge').jqxGauge({
        ticksMajor: { size: '10%', interval: 10, style: { 'stroke-width': 2, stroke: '#aaaaaa' } },
        ticksMinor: { size: '5%', interval: 2.5, style: { 'stroke-width': 1, stroke: '#aaaaaa' } },
        scaleStyle: { stroke: '#aaaaaa', 'stroke-width': 1 },
        value: 75,
        pointer: {
          length: '60%',
          width: 10,
          style: { fill: '#000000' },
          position: { x: 55, y: 200 }
        }
      });
    });
  </script>
</body>
</html>

在这个示例中,我们使用jqxGauge件创建了一个仪表盘,并使用scaleStyle属性设置了刻度线的样式。

示例2:设置jqxLinearGauge刻度线样式

以下是另一个示例,演示如何使用scaleStyle属性设置jqxLinearGauge`的刻度线样式:

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>jQWidgets LinearGauge Example</title>
  <link rel="stylesheet" href="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/styles/jqx.base.css">
  <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  <script src="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/jqxcore.js"></script>
  <script src="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/jqxdata.js"></script>
  <script src="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/jqxbuttons.js"></script>
  <script src="https://cdn.jqwidgets.com/jquery.jqwidgets/4.5.3/jqwidgets/jqxlineargauge.js"></script>
</head>
<body>
  <div id="jqxLinearGauge"></div>
  <script>
    $(document).ready(function () {
      $('#jqxLinearGauge').jqxLinearGauge({
        orientation: 'vertical',
        ticksMajor: { size: '10%', interval: 10, style: { 'stroke-width': , stroke: '#aaaaaa' } },
        ticksMinor: { size: '5%', interval: 2.5, style: { 'stroke-width': 1, stroke: '#aaaaaa' } },
        scaleStyle: { stroke: '#aaaaaa', 'stroke-width': 1 },
        max: 100,
        min: 0,
        value: 75,
        pointer: {
          type: 'arrow',
          size: '5%',
          style: { fill: '#000000' },
          position: '50%'
        }
      });
    });
  </script>
</body>
</html>

在这个示例,我们使用jqxLinearGauge组件创建了一个线性仪表盘,并使用scaleStyle属性设置了刻度线的样式。

综上所述,jqxGaugejqxLinearGauge组件都提供了scaleStyle属性,用于设置刻度线的样式。本文详细介绍了scaleStyle属性的使用和示例。

参考