Module implementing a semi-circular gauge widget.
Requires: d3@v4 du.Widget
du.widgets.lineargauge.LinearGauge(name[, parent])
The linear gauge widget class.
arg type description name stringIdentifier of the widget. parent objectParent element to append widget to. If not specified, widget is appended to body. optional
du.widgets.lineargauge.LinearGauge.min(value)
Sets the lower boundary of the gauge.
arg type description value numberLower boundary.
return description du.widgets.lineargauge.LinearGaugeReference to the current LinearGauge.
du.widgets.lineargauge.LinearGauge.max(value)
Sets the upper boundary of the gauge.
arg type description value numberUpper boundary.
return description du.widgets.lineargauge.LinearGaugeReference to the current LinearGauge.
du.widgets.lineargauge.LinearGauge.thickness(size)
Sets the thickness of the segments in pixels. Default is 20.
arg type description size numberSize of the thickness relative to the gauge radius.
return description du.widgets.lineargauge.LinearGaugeReference to the current LinearGauge.
du.widgets.lineargauge.LinearGauge.tick(on)
Adds a tick on the left side of the gauge bar. Default is false.
arg type description on booleanWhether to add a tick to the side of the bar.
return description du.widgets.lineargauge.LinearGaugeReference to the current LinearGauge.
du.widgets.lineargauge.LinearGauge.trackColor(color)
Sets the track color for the gauge bar. Default is rgba(0, 0, 0, 0.1).
arg type description color stringColor of the track.
return description du.widgets.lineargauge.LinearGaugeReference to the current LinearGauge.
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.colorsarg type description colors string[]Start and end colors of the gauge.
return description du.widgets.lineargauge.LinearGaugeReference to the current LinearGauge.
du.widgets.lineargauge.LinearGauge.position(value)
Sets the position of the gauge bar to the specified value.
arg type description value numberThe value to set the gauge's position to.
return description du.widgets.lineargauge.LinearGaugeReference to the current LinearGauge.