Create interactive histogram visualizations with 'data-ui'. The histogram will perform the calculations in 'JavaScript' if the data is raw. If you would like more control over the calculation, then you can pass pre-binned values with help from hist_to_binned_data. dui_histogram works well as a full-featured visualization or can also be used as a 'sparkline` in smaller contexts.

  rawData = NULL,
  binCount = NULL,
  binType = NULL,
  binValues = NULL,
  cumulative = NULL,
  horizontal = NULL,
  limits = NULL,
  margin = NULL,
  normalized = NULL,
  renderTooltip = NULL,
  valueAccessor = NULL,
  onMouseMove = NULL,
  onMouseLeave = NULL,
  tooltipData = NULL,
  ariaLabel = NULL,
  components = NULL,
  width = 600,
  height = 400,
  elementId = NULL



numeric specifying the approximate number of bins to calculate.


character one of 'numeric'(default) or 'categorical'.


numeric vector of the bin or break values to override the automatic calculations.


logical to specify whether or not the histogram will display cumulative sums of the counts.


logical with TRUE meaning the chart will be in horizontal layout.


numeric vector of length two to give a range for which values will be ignored if they are outside of the range.


list of the form list(top =, right =, bottom =, left=) that will specify the margins for the 'sparkline' chart.


logical specifying whether or not to the values will be calculated as a percent of total.


htmlwidget::JS function that will provide the 'React' element to render when a user moves their mouse over the visualization. The function should follow the signature ({ event, data, datum, color }) =>. If the function returns a falsy value then nothing will be rendered.


htmlwidgets::JS function to let the chart know where to look for the y value in the data. An example would look like (d) => d.yval where yval is the property containing the value.

onMouseMove, onMouseLeave

htmlwidgets::JS function to run on mouse events.


currently not supported.


character accessibility label for the chart


list of children (series or reference lines) to include in the histogram. Multiple components should be wrapped in list such as components = list(dui_densityseries, dui_barseries()).

width, height

numeric valid 'css' size unit. For height, this should always be numeric, but width might be something like '100%' or '50vw'.


character valid 'css' identifier for the htmlwidget container.


react htmlwidget