Module implementing a slider.
Requires: d3@v4 du.Widget
du.widgets.slider.Slider(name[, parent])
The slider widget class.
| arg | type | description |
|---|
| name | string | Identifier of the widget. |
| parent | object | Parent element to append widget to. If not specified, widget is appended to body. optional |
du.widgets.slider.Slider.min(value)
Sets the lower boundary of the slider.
| arg | type | description |
|---|
| value | number | Lower boundary. |
| return | description |
|---|
du.widgets.slider.Slider | Reference to the current Slider. |
du.widgets.slider.Slider.max(value)
Sets the upper boundary of the slider.
| arg | type | description |
|---|
| value | number | Upper boundary. |
| return | description |
|---|
du.widgets.slider.Slider | Reference to the current Slider. |
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).
| arg | type | description |
|---|
| value | number | Step size. |
| return | description |
|---|
du.widgets.slider.Slider | Reference to the current Slider. |
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.
| arg | type | description |
|---|
| func | function | The callback to call on value change. |
| return | description |
|---|
du.widgets.slider.Slider | Reference to the current Slider. |
du.widgets.slider.Slider.track(on)
Shows track (current value) in the slider. Default is false.
| arg | type | description |
|---|
| on | boolean | Whether to show track. |
| return | description |
|---|
du.widgets.slider.Slider | Reference to the current Slider. |
du.widgets.slider.Slider.fillColor(color)
Sets the fill color. Default is black.
| arg | type | description |
|---|
| color | string | The fill color. |
| return | description |
|---|
du.widgets.slider.Slider | Reference to the current Slider. |
du.widgets.slider.Slider.thickness(size)
Sets the slider thickness in pixels. Default is 8.
| arg | type | description |
|---|
| size | string | The slider thickness in pixels. |
| return | description |
|---|
du.widgets.slider.Slider | Reference to the current Slider. |
du.widgets.slider.Slider.trackColor(color)
Sets the track color. Default is #ddd.
| arg | type | description |
|---|
| color | string | The track color. |
| return | description |
|---|
du.widgets.slider.Slider | Reference to the current Slider. |
du.widgets.slider.Slider.format(format)
Sets the tick format. Default is unset.
| arg | type | description |
|---|
| format | Function | The tick format. The tick value is passed as parameter. |
| return | description |
|---|
du.widgets.slider.Slider | Reference to the current Slider. |
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.
| arg | type | description |
|---|
| value | number | The value to set the slider to. |
| return | description |
|---|
du.widgets.slider.Slider | Reference to the current Slider. |