du.widgets.semicirculargauge

Module implementing a semi-circular gauge widget.

Requires: d3@v4 du.Widget

SemiCircularGauge

du.widgets.semicirculargauge.SemiCircularGauge(name[, parent])

The semi-circular 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.semicirculargauge.SemiCircularGauge.min(value)

Sets the lower boundary of the gauge.
argtypedescription
valuenumberLower boundary.
returndescription
du.widgets.semicirculargauge.SemiCircularGaugeReference to the current SemiCircularGauge.

max

du.widgets.semicirculargauge.SemiCircularGauge.max(value)

Sets the upper boundary of the gauge.
argtypedescription
valuenumberUpper boundary.
returndescription
du.widgets.semicirculargauge.SemiCircularGaugeReference to the current SemiCircularGauge.

segments

du.widgets.semicirculargauge.SemiCircularGauge.segments(num)

Sets the number of segments of the gauge bar. Default value is 4.
argtypedescription
numnumberNumber of segments.
returndescription
du.widgets.semicirculargauge.SemiCircularGaugeReference to the current SemiCircularGauge.

gap

du.widgets.semicirculargauge.SemiCircularGauge.gap(num)

Sets the angle of the gap between segments. Default value is 6 degrees.
argtypedescription
numnumberGap angle between segments in degrees.
returndescription
du.widgets.semicirculargauge.SemiCircularGaugeReference to the current SemiCircularGauge.

thickness

du.widgets.semicirculargauge.SemiCircularGauge.thickness(size)

Sets the thickness of the segments in units of the radius. Default is 0.2.
argtypedescription
sizenumberSize of the thickness relative to the gauge radius.
returndescription
du.widgets.semicirculargauge.SemiCircularGaugeReference to the current SemiCircularGauge.

colors

du.widgets.semicirculargauge.SemiCircularGauge.colors(colors)

Sets the min and max color 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.semicirculargauge.SemiCircularGaugeReference to the current SemiCircularGauge.

position

du.widgets.semicirculargauge.SemiCircularGauge.position(value)

Sets the position of the needle to the specified value.
argtypedescription
valuenumberThe value to set the needle's position to. If value is set to null, the needle is hidden.
returndescription
du.widgets.semicirculargauge.SemiCircularGaugeReference to the current SemiCircularGauge.