Skip to content

SamplesGenerator

Description

Initializes the samples generator with the data factory function used to retrieve cell values during sampling.

Members

allowDuplicates

Source code

samplesGenerator.allowDuplicates : boolean

true if duplicate samples collection should be allowed, false otherwise.

Default: {false}

customSampleCount

Source code

samplesGenerator.customSampleCount : number

Custom number of samples to take of each value length.

Default: {null}

dataFactory

Source code

samplesGenerator.dataFactory : function

Function which give the data to collect samples.

includeHidden

Source code

samplesGenerator.includeHidden : boolean

true if hidden samples should be included, false otherwise.

Default: {false}

SAMPLE_COUNT

Source code

SamplesGenerator.SAMPLE_COUNT : number

Number of samples to take of each value length.

samples

Source code

samplesGenerator.samples : Map

Samples prepared for calculations.

Default: {null}

Methods

generateColumnSamples

Source code

samplesGenerator.generateColumnSamples(colRange, rowRange) ⇒ object

Generate samples for column. You can control which area should be sampled by passing colRange object and rowRange object.

ParamTypeDescription
colRangeobject
number
The columns range to generate the samples.
rowRangeobject
Array<number>
The row range (or an explicit list of row indexes) to generate the samples.

generateRowSamples

Source code

samplesGenerator.generateRowSamples(rowRange, colRange) ⇒ object

Generate samples for row. You can control which area should be sampled by passing rowRange object and colRange object.

ParamTypeDescription
rowRangeobject
number
The rows range to generate the samples.
colRangeobject
Array<number>
The column range (or an explicit list of column indexes) to generate the samples.

generateSample

Source code

samplesGenerator.generateSample(type, range, specifierValue, [existingSamples]) ⇒ Map

Generate sample for specified type (row or col).

When existingSamples is provided, the new samples are accumulated into it instead of a fresh map. This lets callers sweep a large range in slices (e.g. one slice per animation frame) while keeping the per-bucket sample limits and the duplicate detection working across slices.

ParamTypeDescription
typestringSamples type row or col.
rangeobject
Array<number>
The range (or an explicit list of indexes) to generate the samples.
specifierValuenumberThe row (for row type) or column (for col type) index to sample.
[existingSamples]Mapoptional A samples map from a previous call to accumulate into.

generateSampleFromValues

Source code

samplesGenerator.generateSampleFromValues(type, entries) ⇒ Map

Generates one samples map from already-known values, bypassing the data factory. Used to bucket-and-cap values that can no longer be read from the data source (e.g. the previous cell values carried by a change batch).

ParamTypeDescription
typestringSamples type row or col.
entriesArrayAn array of { index, value } objects, where index is the opposite-axis index the value belongs to (a row index for col type samples).

generateSamples

Source code

samplesGenerator.generateSamples(type, range, specifierRange) ⇒ Map

Generate collection of samples.

ParamTypeDescription
typestringType to generate. Can be col or row.
rangeobject
Array<number>
The range (or an explicit list of indexes) to generate the samples.
specifierRangeobject
number
The range to generate the samples.

getSampleCount

Source code

samplesGenerator.getSampleCount() ⇒ number

Get the sample count for this instance.

setAllowDuplicates

Source code

samplesGenerator.setAllowDuplicates(allowDuplicates)

Set if the generator should accept duplicate values.

ParamTypeDescription
allowDuplicatesbooleantrue to allow duplicate values.

setIncludeHidden

Source code

samplesGenerator.setIncludeHidden(includeHidden)

Sets the sampler to the mode where it will generate samples for hidden indexes.

ParamTypeDescription
includeHiddenbooleantrue to include hidden indexes, false otherwise.

setSampleCount

Source code

samplesGenerator.setSampleCount(sampleCount)

Set the sample count.

ParamTypeDescription
sampleCountnumberNumber of samples to be collected.

Description

Initializes the samples generator with the data factory function used to retrieve cell values during sampling.

Members

allowDuplicates

Source code

samplesGenerator.allowDuplicates : boolean

true if duplicate samples collection should be allowed, false otherwise.

Default: {false}

customSampleCount

Source code

samplesGenerator.customSampleCount : number

Custom number of samples to take of each value length.

Default: {null}

dataFactory

Source code

samplesGenerator.dataFactory : function

Function which give the data to collect samples.

includeHidden

Source code

samplesGenerator.includeHidden : boolean

true if hidden samples should be included, false otherwise.

Default: {false}

SAMPLE_COUNT

Source code

SamplesGenerator.SAMPLE_COUNT : number

Number of samples to take of each value length.

samples

Source code

samplesGenerator.samples : Map

Samples prepared for calculations.

Default: {null}

Methods

generateColumnSamples

Source code

samplesGenerator.generateColumnSamples(colRange, rowRange) ⇒ object

Generate samples for column. You can control which area should be sampled by passing colRange object and rowRange object.

ParamTypeDescription
colRangeobject
number
The columns range to generate the samples.
rowRangeobject
Array<number>
The row range (or an explicit list of row indexes) to generate the samples.

generateRowSamples

Source code

samplesGenerator.generateRowSamples(rowRange, colRange) ⇒ object

Generate samples for row. You can control which area should be sampled by passing rowRange object and colRange object.

ParamTypeDescription
rowRangeobject
number
The rows range to generate the samples.
colRangeobject
Array<number>
The column range (or an explicit list of column indexes) to generate the samples.

generateSample

Source code

samplesGenerator.generateSample(type, range, specifierValue, [existingSamples]) ⇒ Map

Generate sample for specified type (row or col).

When existingSamples is provided, the new samples are accumulated into it instead of a fresh map. This lets callers sweep a large range in slices (e.g. one slice per animation frame) while keeping the per-bucket sample limits and the duplicate detection working across slices.

ParamTypeDescription
typestringSamples type row or col.
rangeobject
Array<number>
The range (or an explicit list of indexes) to generate the samples.
specifierValuenumberThe row (for row type) or column (for col type) index to sample.
[existingSamples]Mapoptional A samples map from a previous call to accumulate into.

generateSampleFromValues

Source code

samplesGenerator.generateSampleFromValues(type, entries) ⇒ Map

Generates one samples map from already-known values, bypassing the data factory. Used to bucket-and-cap values that can no longer be read from the data source (e.g. the previous cell values carried by a change batch).

ParamTypeDescription
typestringSamples type row or col.
entriesArrayAn array of { index, value } objects, where index is the opposite-axis index the value belongs to (a row index for col type samples).

generateSamples

Source code

samplesGenerator.generateSamples(type, range, specifierRange) ⇒ Map

Generate collection of samples.

ParamTypeDescription
typestringType to generate. Can be col or row.
rangeobject
Array<number>
The range (or an explicit list of indexes) to generate the samples.
specifierRangeobject
number
The range to generate the samples.

getSampleCount

Source code

samplesGenerator.getSampleCount() ⇒ number

Get the sample count for this instance.

setAllowDuplicates

Source code

samplesGenerator.setAllowDuplicates(allowDuplicates)

Set if the generator should accept duplicate values.

ParamTypeDescription
allowDuplicatesbooleantrue to allow duplicate values.

setIncludeHidden

Source code

samplesGenerator.setIncludeHidden(includeHidden)

Sets the sampler to the mode where it will generate samples for hidden indexes.

ParamTypeDescription
includeHiddenbooleantrue to include hidden indexes, false otherwise.

setSampleCount

Source code

samplesGenerator.setSampleCount(sampleCount)

Set the sample count.

ParamTypeDescription
sampleCountnumberNumber of samples to be collected.