Unify Logo Footer.svg
Unify Applications
Logo
Distribution Charts

Distribution Charts

Logo

6 mins READ

Overview

Where bar and line charts answer "what is the value?", distribution charts answer "how does the value vary across observations?". This makes them essential for understanding datasets before summarizing them with a single average, for comparing the spread between two groups, or for spotting outliers that a summary statistic would hide.

VariantBest ForData Shape
HistogramFrequency of values across equal-width buckets; shape of a distributionArray of raw numbers
Box PlotFive-number summary (min, Q1, median, Q3, max) and outliers; comparing groups side by sidePre-computed summary stats per group
Violin PlotFull distribution shape plus summary stats; richer than a box plot when sample sizes are largeArray of numbers per group (rendered via KDE)

Properties Reference

PropertyTypeApplies ToDefaultDescription
chartTypeenumAllhistogramVariant: histogram, boxPlot, violinPlot.
dataarrayAllFor histogram: array of numbers. For boxPlot: array of { label, min, q1, median, q3, max, outliers?: number[] }. For violinPlot: array of { label, values: number[] }.
binsnumberHistogramauto (Sturges formula)Target number of equal-width bins. Auto selects the bin count using Sturges' rule for the dataset size. Setting a fixed number overrides auto.
binSizenumberHistogramFixed bin width in data units. When set, overrides bins. Useful for meaningful bucket sizes (e.g. binSize = 100 for salary data in $100 increments).
showOutliersbooleanBox Plot, ViolintruePlot individual outlier points beyond the whiskers as dots. Box plot reads outliers from the outliers field. Violin plot auto-computes them as values beyond 1.5× IQR.
orientationenum: horizontal | verticalAllverticalVertical = value axis runs upward (default). Horizontal = value axis runs rightward. Horizontal box plots work well with long category label names.
colorcolor (conditional)AllbrandFill color for histogram bars or box/violin fills. Supports conditional rules for coloring based on bin range or category.
fillOpacitynumber (0–1)All0.7Alpha of the fill color. Reduce to 0.3–0.5 on violin plots when overlapping two distributions.
showMeanbooleanHistogram, ViolinfalseDraw a vertical/horizontal line at the arithmetic mean of the dataset.
showMedianLinebooleanViolintrueDraw the median marker inside the violin shape.
bandwidthnumber | "auto"ViolinautoKernel density estimation bandwidth. Auto uses Scott's rule. Set manually to smooth (larger value) or sharpen (smaller value) the violin silhouette.
xAxisLabelstringAllLabel displayed along the X axis.
yAxisLabelstringAllLabel displayed along the Y axis.
tooltipobjectAllautoHover tooltip configuration. Histogram auto-shows bin range and count. Box plot auto-shows all five statistics. Override with a custom format string.

Histogram

A histogram divides the value range into equal-width buckets (bins) and plots a bar whose height represents the count (or density) of observations in that bucket. The shape of the bars reveals whether the data is normal, skewed, bimodal, or uniform.

Setting Up a Histogram

  1. Bind raw data: Set Chart Type = histogram. Bind Data to an array of numbers — e.g. {{ ds_response_times.data.map(r => r.responseMs) }}.

  2. Configure bins: Leave Bins as auto for most datasets. For a time-series like response times in milliseconds, set Bin Size = 50 to bucket in 50ms increments for a meaningful distribution shape.

  3. Add a mean line: Enable Show Mean = true to draw a reference line at the average. Label the axes with X Axis Label = "Response Time (ms)" and Y Axis Label = "Request Count".

Example: API response time histogram

Bind to an array of P50/P95/P99 response time samples from a monitoring data source. Set Bin Size = 25 ms, enable Show Mean, and color bars conditionally: red when bin range > 500ms, amber 250–500ms, green below 250ms. The resulting histogram immediately shows whether traffic is concentrated in fast or slow buckets.

Box Plot

A box plot (box-and-whisker plot) compresses a distribution into five summary statistics: the minimum, first quartile (Q1), median, third quartile (Q3), and maximum. Whiskers extend to the min and max (or to 1.5× IQR, with points beyond shown as outlier dots). Multiple box plots side by side make group comparisons fast.

Data Format for Box Plot

Unlike a histogram, the box plot expects pre-computed statistics. Each group is one object in the data array:

[ { "label": "Engineering", "min": 72000, "q1": 95000, "median": 115000, "q3": 145000, "max": 220000, "outliers": [260000, 310000] }, { "label": "Sales", "min": 55000, "q1": 70000, "median": 88000, "q3": 110000, "max": 165000 } ]

Tip: Most SQL databases support PERCENTILE_CONT(0.25) WITHIN GROUP (ORDER BY value) to compute quartiles server-side. Return one row per group with the five stats as columns. This avoids loading thousands of raw values into the browser.

Violin Plot

A violin plot is a richer alternative to the box plot: it shows the full kernel density estimate (KDE) of the distribution as a mirrored shape, with optional box plot statistics overlaid in the center. Use it when sample sizes are large enough that the shape of the distribution is meaningful — at least 30–50 data points per group.

Note: Unlike the box plot, violin plots require the raw values array per group because the KDE is computed in the browser. Limit to datasets under ~10,000 points total to avoid layout slowdown. For larger samples, use the box plot with pre-aggregated stats instead.

Events & Exposed State

Event / StateDescription
onBinClickFires when user clicks a histogram bar. Payload: { binStart, binEnd, count }. Use to filter a data table to the records in that bin range.
onBoxClickFires when user clicks a box plot box. Payload: { label, min, q1, median, q3, max }.
{{ id.selectedBin }}The most recently clicked histogram bin object, or null.

Examples

Example: Salary band box plot for HR compensation review

Query compensation data aggregated by department into the five-number summary. Render a horizontal box plot (Orientation = horizontal) with Show Outliers = true. Long department names fit naturally on the Y axis in horizontal orientation. Click a box to navigate to a department detail page using the onBoxClick event with a Navigate action.

Example: A/B test metric violin

Load raw conversion-time values for each test variant into a violin plot with two groups (Control, Variant). Enable Show Median Line = true. The width of each violin at a given value shows how many users experienced that conversion time — a wide midsection means most users clustered around the median, a long tail reveals slow outliers. This is far more informative than a bar chart showing only average conversion time.

PageRelationship
Scatter & Bubble ChartsIndividual data points — complementary to histograms for small datasets
Bar & Column ChartsUse when you need aggregate comparisons rather than distributional shape
Circular ChartsProgress and part-to-whole — complementary for KPI views alongside distributions