Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

jQWidgets jqxKnob marks Property

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful, optimized, platform-independent, and widely supported framework. The jqxKnob is used for representing a jQuery plugin having a round shape and displaying a draggable indicator within a range of the specified values. This API can also be used in a table or matrix for showing the relative value of a field in a range of values in the specified data region. This API supports HTML5, SVG, & VML rendering.

The marks property is used for setting or getting the marks property for the specified jqxKnob. It is of the object type & its default value is null.

Syntax:

  • For setting the marks property:
$('#jqxKnob').jqxKnob({
    marks: {
        colorRemaining: { color: 'red' },
        colorProgress: { color: 'green' },
        offset: '70%',
        thickness: 5,
        size: '4%'
    }
});
  • For getting the marks property:
var allowValueChangeOnClick = $('#jqxKnob').jqxKnob('marks');

There are several properties of Knob’s marks property, that are given below:

  • colorProgress: It is used to represent the hex color string.
  • colorRemaining:  It is also used to represent the hex color string.
  • drawAboveProgressBar: It is used to draw the marks with a z-index higher than the progress bar.
  • minorInterval: It shows the minor ticks interval.
  • majorInterval: It shows the major ticks interval.
  • majorSize: It shows a major tick’s size that specifies the radius in case of circular lines, or length in case of lines.
  • offset: It is used to specify the labels offset.
  • size: It is used to specify the radius in the case of circular lines or length in the case of lines.
  • type: It can be of “circle” or “line” type.
  • thickness: It is used to specify thickness in the case of lines.
  • visible: It is used to determine the label’s visibility.

 

Linked Files: Download jQWidgets from the given link. In the HTML file, locate the script files in the downloaded folder.

<link rel=”stylesheet” href=”jqwidgets/styles/jqx.base.css” type=”text/css” />
<script type=”text/javascript” src=”scripts/jquery.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxbuttons.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxdraw.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxknob.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxnumberinput.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqx-all.js”></script>

Example: The below example illustrates the jQWidgets jqxKnob marks property.

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.js">
    </script>
    <script type="text/javascript" 
            src="jqwidgets/jqxcore.js">
    </script>
    <script type="text/javascript" 
            src="jqwidgets/jqxbuttons.js">
    </script>
    <script type="text/javascript" 
            src="jqwidgets/jqxdraw.js">
    </script>
    <script type="text/javascript" 
            src="jqwidgets/jqxknob.js">
    </script>
    <script type="text/javascript" 
            src="jqwidgets/jqxnumberinput.js">
    </script>
    <script type="text/javascript" 
            src="jqwidgets/jqx-all.js">
    </script>
</head>
  
<body>
    <center>
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>
        <h3>
            jQWidgets jqxKnob marks Property
        </h3>
        <div id='jqx_Knob'>
        </div>
        <script type="text/javascript">
            $(document).ready(function () {
                $('#jqx_Knob').jqxKnob({
                    value: 5,
                    min: 0,
                    max: 50,
                    width: 300,
                    startAngle: 0,
                    endAngle: 360,
                    snapToStep: true,
                    marks: {
                        colorRemaining: { color: 'red' },
                        colorProgress: { color: 'green' },
                        offset: '70%',
                        thickness: 5,
                        size: '4%'
                    },
                    labels: {
                        offset: '85%',
                        step: 5
                    },
                    progressBar: {
                        style: {
                            fill: 'yellow',
                            stroke: 'black'
                        },
                        size: '8%',
                        offset: '61%',
                        background: { fill: 'black' }
                    },
                    pointer: {
                        type: 'arrow',
                        style: { fill: 'green' },
                        size: '68%',
                        offset: '29%',
                        thickness: 15
                    }
                });
            });
        </script>
    </center>
</body>
  
</html>

Output:

Reference: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxknob/jquery-knob-api.htm?search=


My Personal Notes arrow_drop_up
Last Updated : 28 Nov, 2021
Like Article
Save Article
Similar Reads
Related Tutorials