du.widgets.slider

Module implementing a slider.

Requires: d3@v4 du.Widget

Slider

du.widgets.slider.Slider(name[, parent])

The slider widget class.
argtypedescription
namestringIdentifier of the widget.
parentobjectParent element to append widget to. If not specified, widget is appended to body. optional

min

du.widgets.slider.Slider.min(value)

Sets the lower boundary of the slider.
argtypedescription
valuenumberLower boundary.
returndescription
du.widgets.slider.SliderReference to the current Slider.

max

du.widgets.slider.Slider.max(value)

Sets the upper boundary of the slider.
argtypedescription
valuenumberUpper boundary.
returndescription
du.widgets.slider.SliderReference to the current Slider.

step

du.widgets.slider.Slider.step(value)

Sets the step of the slider scale for ordinal scale. If zero is passed, a continuous scale is used. Default is 0 (continuous scale).
argtypedescription
valuenumberStep size.
returndescription
du.widgets.slider.SliderReference to the current Slider.

callback

du.widgets.slider.Slider.callback(func)

Sets callback attached to the slider. Must accept one parameter describing the value of the slider. By default no callback is set.
argtypedescription
funcfunctionThe callback to call on value change.
returndescription
du.widgets.slider.SliderReference to the current Slider.

track

du.widgets.slider.Slider.track(on)

Shows track (current value) in the slider. Default is false.
argtypedescription
onbooleanWhether to show track.
returndescription
du.widgets.slider.SliderReference to the current Slider.

fillColor

du.widgets.slider.Slider.fillColor(color)

Sets the fill color. Default is black.
argtypedescription
colorstringThe fill color.
returndescription
du.widgets.slider.SliderReference to the current Slider.

thickness

du.widgets.slider.Slider.thickness(size)

Sets the slider thickness in pixels. Default is 8.
argtypedescription
sizestringThe slider thickness in pixels.
returndescription
du.widgets.slider.SliderReference to the current Slider.

trackColor

du.widgets.slider.Slider.trackColor(color)

Sets the track color. Default is #ddd.
argtypedescription
colorstringThe track color.
returndescription
du.widgets.slider.SliderReference to the current Slider.

format

du.widgets.slider.Slider.format(format)

Sets the tick format. Default is unset.
argtypedescription
formatFunctionThe tick format. The tick value is passed as parameter.
returndescription
du.widgets.slider.SliderReference to the current Slider.

position

du.widgets.slider.Slider.position(value)

Sets the position of the slider to the specified value. Note that setting the value with this method does not trigger the callback function.
argtypedescription
valuenumberThe value to set the slider to.
returndescription
du.widgets.slider.SliderReference to the current Slider.