du.widgets.histogram

Module implementing an interactive histogram.

Requires: d3@v4 du.Widget

Histogram

du.widgets.histogram.Histogram(name[, parent])

The bar chart 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.histogram.Histogram.min(value)

Sets the lower boundary of the histogram. Default is unset (calculated automatically from data).
argtypedescription
valuenumberValue to set as lower boundary.
returndescription
du.widgets.histogram.HistogramReference to the current Histogram.

max

du.widgets.histogram.Histogram.max(value)

Sets the upper boundary of the histogram. Default is unset (calculated automatically from data).
argtypedescription
valuenumberValue to set as upper boundary.
returndescription
du.widgets.histogram.HistogramReference to the current Histogram.

bin

du.widgets.histogram.Histogram.bin(size)

Sets the bin width of the histogram. Default is unset (calculated automatically from data using the Friedman-Diaconis rule).
argtypedescription
sizenumberBin size to set.
returndescription
du.widgets.histogram.HistogramReference to the current Histogram.

normalize

du.widgets.histogram.Histogram.normalize(on)

Normalizes histogram counts to 1. Default is false.
argtypedescription
onbooleanWhether normalization is on.
returndescription
du.widgets.histogram.HistogramReference to the current Histogram.

data

du.widgets.histogram.Histogram.data(data)

Binds data to the histogram. Expected data format: array of single numbers or array of x, y values. If binnedData is set to false, data will be binned automatically, otherwise it displayed as it is.
argtypedescription
dataArrayData to plot.
returndescription
du.widgets.histogram.HistogramReference to the current Histogram.

highlight

du.widgets.histogram.Histogram.highlight(key, duration)

Highlights the specified plot.
argtypedescription
keystring string[]Single key or an array of keys of the bar(s) to highlight.
durationnumberDuration of the highlight animation.
returndescription
du.widgets.histogram.HistogramReference to the current Histogram.