Questions tagged [jquery-knob]

An jQuery-based spinner/dial control.

jQuery Knob canvas based ; no png or jpg sprites. touch, mouse and mousewheel, keyboard events implemented. downward compatible ; overloads an input element.

Useful links:

Example

<input type="text" value="75" class="dial">

$(function() {
    $(".dial").knob();
}

enter image description here

Options

Options are provided as attributes 'data-option':

<input type="text" class="dial" data-min="-50" data-max="50">

... or in the "knob()" call :

$(".dial").knob({
                'min':-50
                ,'max':50
                })

The following options are supported :

  • Behaviors :

    • min : min value | default=0.
    • max : max value | default=100.
    • angleOffset : starting angle in degrees | default=0.
    • angleArc : arc size in degrees | default=360.
    • stopper : stop at min & max on keydown/mousewheel | default=true.
    • readOnly : disable input and events | default=false.

  • UI :
    • cursor : display mode "cursor" | default=gauge.
    • thickness : gauge thickness.
    • width : dial width.
    • displayInput : default=true | false=hide input.
    • displayPrevious : default=false | true=displays the previous value with transparency.
    • fgColor : foreground color.
    • bgColor : background color.

  • Hooks

    $(".dial").knob({ 'release' : function (v) { /make something/ } });

  • 'release' : executed on release

    Parameters :

    value : int, current value


- 'change' : executed at each change of the value
Parameters :

value : int, current value
'draw' : when drawing the canvas


The scope (this) of each hook function is the current Knob instance (refer to the demo code).

Example

<input type="text" value="75" class="dial">

<script>
$(".dial").knob({
                 'change' : function (v) { console.log(v); }
                });
</script>

Dynamically configure

<script>
$('.dial')
    .trigger(
        'configure',
        {
        "min":10,
        "max":40,
        "fgColor":"#FF0000",
        "skin":"tron",
        "cursor":true
        }
    );
</script>

Set the value

<script>
$('.dial')
    .val(27)
    .trigger('change');
</script>

Supported browser Tested on Chrome, Safari, Firefox, IE 9.0.

145 questions
21
votes
2 answers

Adding Percentages to jquery knob input value

I'm using jQuery plugin called Jquery Knob http://anthonyterrien.com/knob/ To create circular progress bar , So here's my code
Khalid Khalil
  • 419
  • 1
  • 6
  • 14
7
votes
4 answers

How to add a value suffix in jQuery.knob

I have problem with jQuery.knob I need to add a Sufixx to the value in the knob. For Example: i need a Sufix $ after the value, i just put in the value field, its displaying, but at that time the knob will not show the status. it will not show the…
ReNiSh AR
  • 2,782
  • 2
  • 30
  • 42
6
votes
1 answer

How to change font size in JQuery knob

I have a problem in jQuery Knob plugin.I want to change the font size inside the circle and change the content of the input text.
M Muneer
  • 377
  • 4
  • 17
6
votes
2 answers

How to change knob value dynamically in jquery..?

I have applied a jquery knob with readonly feature as follows :
Ritesh
  • 4,720
  • 6
  • 27
  • 41
6
votes
1 answer

How to install bower package with a slash in the name?

I'm trying to install https://github.com/aterrien/jQuery-Knob through bower. In the bower.json file of the package I see: { "name": "aterrien/jQuery-Knob", "version": "1.2.9", .. } So in my bower.json file I put in: "aterrien/jQuery-Knob":…
user258598
  • 61
  • 3
6
votes
2 answers

jquery knob angular gradient

Is there any way to add angular gradient to jQuery knob plugin, so that it starts from one color and along the arc, changes into another?
Adee
  • 464
  • 6
  • 17
4
votes
1 answer

How to get id of Jquery knob

I am using jquery knob,I want to get the id of the knob on change function. $(".dial").knob({ 'min': 0, 'max': 5, 'readOnly': false, 'width': 70, 'height': 70, 'dynamicDraw': true, change: function(value) { console.log("changed…
user90
  • 63
  • 5
4
votes
1 answer

Surrounding an input element with a jQuery Knob Dial

The following code snippet converts an element into a jQuery-knob dial: It looks as follows: Problem: I'd like to use the…
George
  • 6,927
  • 4
  • 34
  • 67
4
votes
3 answers

Disable Mousewheel on jQuery Knob

Is is possible? jQuery Knob I am trying to disable the mousewheel, but still allow it to be draggable/adjustable. You can set the knob to readOnly: true, but that won't let you drag the dial. Any ideas? $(".dial").knob({ min: 1 max: 10 …
user1791914
  • 616
  • 9
  • 23
4
votes
1 answer

How to draw multiple arc in single dial using jquery knob?

I would like to have multiple arc in single dial using jquery knob. Is it possible? See below image. The code I have tried so far. $(".dial").knob({ 'readOnly': true, 'displayPrevious': true, change :…
Nikhil N
  • 4,507
  • 1
  • 35
  • 53
4
votes
2 answers

Negative z-indexed div not showing behind a div with a bg-color

I have an extension to the wonderful jquery knob, which turns it into a degree range input. There's a transparent compass png image positioned on the knob within a div with a negative z-index, so mouse clicks will interact with the knob rather with…
shaharsol
  • 991
  • 2
  • 10
  • 31
3
votes
1 answer

Weird behaviour on mousedrag, javascript

So I am using knob.js to create two dials, one inside another. The Outer dial represents the cumulative rating of a book, i.e. the average of all the ratings. This outer dial has data-readOnly="true" and it's value is visible at the common center of…
suneet
  • 400
  • 1
  • 5
  • 19
3
votes
1 answer

Change jQuery Knob Min/Max value

I'm working on an angular wrapper for the jquery-knob widget. The following works as long as the maximum value doesn't change. If it does, the ng-model binding is lost. If I don't destroy the knob widget at the beginning of the watch, the max value…
AaronF
  • 2,841
  • 3
  • 22
  • 32
3
votes
1 answer

Jquery change color on click - knob knob

I am using jquery knob knob on my site to create some nice visuals. I wish to change the color using a click event. I have provided a simplified fiddle of what I am trying to achieve. I have been trying for several hours and now have to ask for…
user1320260
3
votes
1 answer

Change color of a knob using query-knob

i'm using knob jQuery to create an interactive knob, that, allowing sunstantial to see how much energy is consuming its power grid this is the code that generate the knob $(function(){ $(".dial").knob({ 'min':0, …
Riccardo Canella
  • 200
  • 2
  • 13
1
2 3
9 10