Circular

Circular

new Circular(optionsopt)

Source:
Properties:
Name Type Attributes Default Description
options.value Number <optional>
0

Sets the value on the hand and on the ring at the same time.

options.value_hand Number <optional>
0

Sets the value on the hand.

options.value_ring Number <optional>
0

Sets the value on the ring.

options.size Number <optional>
100

The diameter of the circle. This is the base value for all following layout-related parameters. Keeping it set to 100 offers percentual lenghts. Set the final size of the widget via CSS.

options.thickness Number <optional>
3

The thickness of the circle.

options.margin Number <optional>
0

The margin between base and value circles.

options.show_hand Boolean <optional>
true

Draw the hand.

options.hand Object <optional>

Dimensions of the hand.

Properties
Name Type Attributes Default Description
width Number <optional>
2

Width of the hand.

length Number <optional>
30

Length of the hand.

margin Number <optional>
10

Margin of the hand.

options.start Number <optional>
135

The starting point in degrees.

options.angle Number <optional>
270

The maximum degree of the rotation when options.value === options.max.

options.base Number | Boolean <optional>
false

If a base value is set in degrees, circular starts drawing elements from this position.

options.show_base Boolean <optional>
true

Draw the base ring.

options.show_value Boolean <optional>
true

Draw the value ring.

options.x Number <optional>
0

Horizontal displacement of the circle.

options.y Number <optional>
0

Vertical displacement of the circle.

options.show_dots Boolean <optional>
true

Show/hide all dots.

options.dots_defaults Object <optional>

This option acts as default values for the individual dots specified in options.dots.

Properties
Name Type Attributes Default Description
width Number <optional>
2

Width of the dots.

length Number <optional>
2

Length of the dots.

margin Number <optional>
5

Margin of the dots.

options.dots Array.<(Object|Number)> <optional>
[]

An array of objects describing where dots should be placed along the circle. Members are position pos in the value range and optionally color and class and any of the properties of options.dot. Optionally a number defining the position can be set.

options.show_markers Boolean <optional>
true

Show/hide all markers.

options.markers_defaults Object <optional>

This option acts as default values of the individual markers specified in options.markers.

Properties
Name Type Attributes Default Description
thickness Number <optional>
3

Thickness of the marker.

margin Number <optional>
3

Margin of the marker.

options.markers Array.<Object> <optional>
[]

An array containing objects which describe where markers are to be places. Members are the position as from and to and optionally color, class and any of the properties of options.marker.

options.show_labels Boolean <optional>
true

Show/hide all labels.

options.labels_defaults Object <optional>

This option acts as default values for the individual labels specified in options.labels.

Properties
Name Type Attributes Default Description
margin Integer <optional>
8

Distance of the label from the circle of diameter options.size.

align String <optional>
"outer"

This option controls if labels are positioned inside or outside of the circle with radius options.size/2 - margin.

format function <optional>

Optional formatting function for the label. Receives the label value as first argument.

options.labels Array.<Object> <optional>
[]

An array containing objects which describe labels to be displayed. Either a value or an object whose members are the position pos inside the value range and optionally label, color, class and any of the properties of options.labels_defaults.

Circular is a SVG group element containing two paths for displaying numerical values in a circular manner. Circular is able to draw labels, dots and markers and can show a hand. Circular e.g. is implemented by Clock to draw hours, minutes and seconds.

Parameters:
Name Type Attributes Default Description
options Object <optional>
{ }

An object containing initial options.

Extends

Members

_base :SVGPath

Source:

The base of the ring. Has class .aux-base

Type:
  • SVGPath

_dots :SVGGroup

Source:

A group containing all dots. Has class .aux-dots

Type:
  • SVGGroup

_hand :SVGRect

Source:

The hand of the knob. Has class .aux-hand

Type:
  • SVGRect

_labels :SVGGroup

Source:

A group containing all labels. Has class .aux-labels

Type:
  • SVGGroup

_markers :SVGGroup

Source:

A group containing all markers. Has class .aux-markers

Type:
  • SVGGroup

_value :SVGPath

Source:

The ring showing the value. Has class .aux-value

Type:
  • SVGPath

element :SVGImage

Source:

The main SVG element. Has class .aux-circular

Type:
  • SVGImage

Methods

addChild(child)

Source:
Inherited From:
See:

Registers a widget as a child widget. This method is used to build up the widget tree. It does not modify the DOM tree.

Parameters:
Name Type Description
child Widget

The child to add.

Fires:
  • Widget#event:child_added

addChildren(a)

Source:
Inherited From:

Registers an array of widgets as children.

Parameters:
Name Type Description
a Array.<Widget>

An array of Widgets.

addLabel(label) → {Object}

Source:

Adds a label.

Parameters:
Name Type Description
label Object | Number

The label. Please refer to the options to learn more about possible values.

Returns:

label - The interpreted object to build the label from.

Type
Object

allChildren()

Source:
Inherited From:

Returns an array of all children.

appendChild(child)

Source:
Inherited From:

Appends child.element to the widget element and registers child as a child widget.

Parameters:
Name Type Description
child Widget

The child widget to append.

appendChildren(children)

Source:
Inherited From:

Calls Widget#appendChild for an array of widgets.

Parameters:
Name Type Description
children Array.<Widget>

The child widgets to append.

disableTansitions()

Source:
Inherited From:

Disable CSS transitions.

enableDraw()

Source:
Overrides:

Schedules this widget for drawing.

Fires:

enableDrawChildren()

Source:
Inherited From:

Enables rendering for all children of this widget.

enableTransitions()

Source:
Inherited From:

Enable CSS transitions.

forceHide()

Source:
Inherited From:

Hide the widget immediately by applying the class aux-hide. Does not call disableDraw().

forceShow()

Source:
Inherited From:

Show the widget immediately by applying the class aux-show. Does not call enableDraw().

getStyle()

Source:
Inherited From:

Returns the computed style of this widget's DOM element.

hidden()

Source:
Inherited From:

Returns the current hidden status.

hide()

Source:
Inherited From:

Hide the widget. This will result in the class aux-hide being applied to this widget in the next rendering step.

invalidate(key)

Source:
Inherited From:

Invalidates an option and triggers a redraw() call.

Parameters:
Name Type Description
key string

observeResize(cb)

Source:
Inherited From:

Calls a callback whenever the widget resizes. This method will trigger one resize.

Parameters:
Name Type Description
cb function

removeChild(child)

Source:
Inherited From:

Removes a child widget. Note that this method only modifies the widget tree and does not change the DOM.

Parameters:
Name Type Description
child Widget

The child to remove.

Fires:
  • Widget#event:child_removed

removeChildren(a)

Source:
Inherited From:

Removes an array of children.

Parameters:
Name Type Description
a Array.<Widget>

An array of Widgets.

removeLabel(label) → {Object}

Source:

Removes a label.

Parameters:
Name Type Description
label Object

The label object as returned from addLabel.

Returns:

label - The removed label object.

Type
Object

set(key, value)

Source:
Overrides:

Sets an option.

Parameters:
Name Type Description
key string

The option name.

value

The option value.

setStyle()

Source:
Inherited From:

Sets a CSS style property in this widget's DOM element.

show()

Source:
Inherited From:

Make the widget visible. This will apply the class aux-show during the next rendering step.

toggleHidden()

Source:
Inherited From:

Toggle the hidden status. This is equivalent to calling hide() or show(), depending on the current hidden status of this widget.

transitionsDisabled()

Source:
Inherited From:

Returns true if transitions are currently disabled on this widget.

visibleChildren()

Source:
Inherited From:

Returns an array of all visible children.

Events

destroy

Source:
Inherited From:

Is fired when a widget is destroyed.

dotsdrawn

Source:

Is fired when dots are (re)drawn.

doubleclick

Source:
Inherited From:

Is fired after a double click appeared. Set dblclick to 0 to disable click event handling.

Parameters:
Name Type Description
event string

The browsers MouseEvent.

GenericDOMEvents

Source:
Inherited From:

Generic DOM events. Please refer to W3Schools for further details.

hide

Source:
Inherited From:

The hide event is emitted when a widget is hidden and is not rendered anymore. This happens both with browser visibility changes and also internally when using layout widgets such as Pager.

initialized

Source:
Inherited From:

Is fired when a widget is initialized.

labelsdrawn

Source:

Is fired when labels are (re)drawn.

markersdrawn

Source:

Is fired when markers are (re)drawn.

redraw

Source:
Inherited From:

The redraw event is emitted when a widget is redrawn. This can be used to do additional DOM modifications to a Widget.

resize

Source:
Inherited From:

The resize event is emitted whenever a widget is being resized. This event can be used to e.g. measure its new size. Note that some widgets do internal adjustments after the resize event. If that is relevant, the Widget#resized event can be used instead.

resized

Source:
Inherited From:

The resized event is emitted after each rendering frame, which was triggered by a resize event.

set

Source:
Inherited From:

The set event is emitted when an option was set using the Widget#set method. The arguments are the option name and its new value.

Note that this happens both for user interaction and programmatical option changes.

show

Source:
Inherited From:

The show event is emitted when a widget is shown and is being rendered. This is the counterpart to Widget#hide.

visibility

Source:
Inherited From:

Is fired when the visibility state changes. The first argument is the visibility state, which is either true or false.