Skip to main content

Histogram

The Histogram class contains the complete data of an histogram. It is derived from the VisionElement base class.

Constructors​

Empty constructor.

new Histogram(): Histogram;

Constructor with the initial values of the histogram. Each element of the array is a bin that contains the counts, or frequency of the value of the bin. The start value will be 0, the end value is the length of the array minus 1, and the bin width is 1.

new Histogram(values: number[]): Histogram;

Methods​

start()​

Returns the value of the first bin of the histogram.

start(): number;

end()​

Returns the value of the last bin of the histogram.

end(): number;

binWidth()​

Returns the width of each bin.

binWidth(): number;

numBins()​

Returns the number of bins.

numBins(): number;

getCounts()​

Returns the list of histogram counts for all bins. The counts are the frequency of the value of the bin.

getCounts(): number[];

getCount()​

Returns the histogram count at the given bin index.

getCount(index: number): number;

isValid()​

Returns true if the histogram values are valid.

isValid(): boolean;

Props​

color​

The color of the line and filling of the histogram in hexadecimal format.

color: string;

filled​

If true, the histogram will be filled with the color.

filled: boolean;