Skip to content

@graphty/graphty-element / session / Histogram

Interface: Histogram ​

Defined in: graphty-element/src/session/results/types.ts:715

A field's distribution, and how it was actually drawn.

THE LAYOUT IS REPORTED BECAUSE IT IS NOT ALWAYS THE ONE ASKED FOR. A column with no positive values, or whose positive values all sit at one magnitude, has no logarithmic layout -- so a request for "log" is laid out linearly rather than refused, because refusing to draw a distribution is worse than drawing it on the other axis. A caption written from the REQUEST then says "log scale" over a linear chart, which is a false claim about the data, and it is a claim a consumer cannot check without recomputing the column. So Histogram.scale says what was applied, and a caption reads that.

Properties ​

binning ​

readonly binning: HistogramBinning

Defined in: graphty-element/src/session/results/types.ts:733

Whether every distinct value got a bar of its own, bands were laid out, or nothing was measured. A per-value histogram ignores the scale, because it has no bands to space.


bins ​

readonly bins: readonly HistogramBin[]

Defined in: graphty-element/src/session/results/types.ts:717

The bars, in ascending order.


scale ​

readonly scale: "linear" | "log"

Defined in: graphty-element/src/session/results/types.ts:719

The scale the bars are really on.


suggestedScale ​

readonly suggestedScale: "linear" | "log"

Defined in: graphty-element/src/session/results/types.ts:728

The scale this column's spread argues for, whatever was asked for.

A recommendation and nothing acts on it: which axis to draw is the reader's choice, and a chart that silently changed scale would be claiming a shape nobody asked for. It is "linear" whenever a logarithmic layout could not be applied anyway, so passing it straight back in HistogramOptions.scale always yields the scale it named.