Skip to content

Histogram

A frequency-distribution chart: bins continuous values into equal-width buckets and renders the counts as a BarChart. Useful for benchmark distributions, latency percentiles, request-size histograms.

See also: BarChart for values you already have per category.

Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.

// Pass raw samples; the chart buckets them into equal-width bins.
Histogram(values: latenciesMs, bins: 7, showValues: true)

Range defaults to autoscaled [min(values), max(values)]. Bin labels are the midpoint of each bucket; when they would collide, only an evenly spaced subset is shown, and showLabels: false turns them off.

Screen readers and agents get one chart node: semanticLabel plus the bin count, how many values fell in the range, and the range’s low and high ends, not a node per bin.

ParameterTypeDefaultDescription
values:List<num>requiredRaw observations to bin.
bins:int10Number of equal-width bins (≥ 1).
range:(num, num)?—Explicit (low, high) range. null autoscales to [min, max] of values. Values outside the range are dropped.
showLabels:booltrueWhether bars show their bin midpoint labels. When labels would collide, only an evenly spaced subset is shown.
showValues:boolfalseWhether each bar shows its observation count.
barWidth:int2Width of each bar in terminal cells.
gap:int0Horizontal gap between adjacent bars in terminal cells.
color:Color?—Bar color override; defaults to the theme’s primary.
semanticLabel:String'Histogram'Label exposed through the semantic app graph.

Histogram is defined in packages/fleury/lib/src/catalog/histogram.dart.

Category: Charts & meters · All widgets