du.widgets.lineargauge

Module implementing a semi-circular gauge widget.

Requires: d3@v4 du.Widget

LinearGauge

du.widgets.lineargauge.LinearGauge(name[, parent])

The linear gauge 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.lineargauge.LinearGauge.min(value)

Sets the lower boundary of the gauge.
argtypedescription
valuenumberLower boundary.
returndescription
du.widgets.lineargauge.LinearGaugeReference to the current LinearGauge.

max

du.widgets.lineargauge.LinearGauge.max(value)

Sets the upper boundary of the gauge.
argtypedescription
valuenumberUpper boundary.
returndescription
du.widgets.lineargauge.LinearGaugeReference to the current LinearGauge.

thickness

du.widgets.lineargauge.LinearGauge.thickness(size)

Sets the thickness of the segments in pixels. Default is 20.
argtypedescription
sizenumberSize of the thickness relative to the gauge radius.
returndescription
du.widgets.lineargauge.LinearGaugeReference to the current LinearGauge.

tick

du.widgets.lineargauge.LinearGauge.tick(on)

Adds a tick on the left side of the gauge bar. Default is false.
argtypedescription
onbooleanWhether to add a tick to the side of the bar.
returndescription
du.widgets.lineargauge.LinearGaugeReference to the current LinearGauge.

trackColor

du.widgets.lineargauge.LinearGauge.trackColor(color)

Sets the track color for the gauge bar. Default is rgba(0, 0, 0, 0.1).
argtypedescription
colorstringColor of the track.
returndescription
du.widgets.lineargauge.LinearGaugeReference to the current LinearGauge.

colors

du.widgets.lineargauge.LinearGauge.colors(colors)

Sets the min and max colors of the gauge. Must be an array with two colors. The color of intermediate segments is interpolated with HSL interpolation. Default values are the first red and green colors from Color Brewer (['#e41a1c', '#4daf4a']).
Overrides: du.widgets.Widget.colors
argtypedescription
colorsstring[]Start and end colors of the gauge.
returndescription
du.widgets.lineargauge.LinearGaugeReference to the current LinearGauge.

position

du.widgets.lineargauge.LinearGauge.position(value)

Sets the position of the gauge bar to the specified value.
argtypedescription
valuenumberThe value to set the gauge's position to.
returndescription
du.widgets.lineargauge.LinearGaugeReference to the current LinearGauge.