Skip to content
import AutoIntervalBinParameters from "@arcgis/core/rest/support/AutoIntervalBinParameters.js";
Inheritance:
AutoIntervalBinParametersBinParametersBaseAccessor
Since
ArcGIS Maps SDK for JavaScript 4.32

AutoIntervalBinParameters specifies binParameters on AttributeBinsQuery object. It defines the number of numBins, and the start and end values for binning on a specified field. Bin size is automatically calculated based on the range between the start and end values and the number of bins. The end value will be included in the last bin. The AutoIntervalBinParameters does not support timestamp-offset, date-only, or time-only field types.

When analyzing annual accident data across the USA, focusing on the time of day accidents occurred, you can use auto interval bin to visualize the distribution of accidents throughout different hours of the day. The bin parameters would be:

// Query bins with auto interval bin parameters based on field "HOUR" with 24 bins.
const binQuery = new AttributeBinsQuery({
where: "Unit = 0",
binParameters: new AutoIntervalBinParameters({
numBins: 24,
field: "HOUR", // the field to bin, containing the hours of the day
start: 0, // the lower boundary of the first bin
end: 24 // the upper boundary of the last bin
})
});
color-blend Total accidents in the USA by hour for the year 2021. Each bin represents the number of accidents that occurred during each hour of the day. The chart is based on the results obtained from the bin query shown above.
See also

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

end

Property
Type
number | Date | null | undefined

The end value of bins to generate. The value can be a number or a date.

expression

inherited Property
Type
string | null | undefined
Inherited from: BinParametersBase

A standardized SQL expression used to calculate the bins, rather than referencing a field. The specified SQL expression must evaluate to a numeric or date type. Both field and the expression cannot be specified for the same bin. The expressionValueType property must be set to the expected data type of the output from the expression.

See also
Example
const binQuery = new AttributeBinsQuery({
binParameters: new AutoIntervalBinParameters({
numBins: 5, // the interval size for each bin
// sql expression to calculate the bins based on the product of Quantity and SalesAmount
expression: "Quantity * SalesAmount"
expressionValueType: "double"
})
});

expressionValueType

inherited Property
Type
BinParameterFieldType | null | undefined
Inherited from: BinParametersBase

Specifies the expected data type of the output from the expression, based on the type of value the expression generates. The expression property must be set when this property is set.

See also
Example
const binQuery = new AttributeBinsQuery({
binParameters: new AutoIntervalBinParameters({
numBins: 5, // the interval size for each bin
// sql expression to calculate the bins based on the product of Quantity and SalesAmount
expression: "Quantity * SalesAmount"
expressionValueType: "double"
})
});

field

inherited Property
Type
string | null | undefined
Inherited from: BinParametersBase

The field name used to calculate the bins. The expression property cannot be set when this property is set.

See also

firstDayOfWeek

inherited Property
Type
number | null | undefined
Inherited from: BinParametersBase

The first day of the week. This property is used to determine the start of the week for date-based bins. The default value is 7, representing Sunday, if no value is specified.

hideUpperBound

inherited Property
Type
boolean | null | undefined
Inherited from: BinParametersBase

If true, the upperBoundary and bin fields will not be included in the attributes.

normalizationField

inherited Property
Type
string | null | undefined

Name of the numeric field used to normalize values during binning. The normalization field must be specified when the normalizationType is set to field. Only non-zero values from the normalizationField are used during binning.

normalizationMaxValue

inherited Property
Type
number | null | undefined

The maximum value used to normalize the data during binning. It ensures that all data points are scaled relative to this maximum value.

Known Limitations

The normalizationMaxValue is only supported with server-side FeatureLayers.

normalizationMinValue

inherited Property
Type
number | null | undefined

The minimum value used to normalize the data during binning. It ensures that all data points are scaled relative to this minimum value.

Known Limitations

The normalizationMinValue is only supported with server-side FeatureLayers.

normalizationTotal

inherited Property
Type
number | null | undefined

The total value used when the normalizationType is percent-of-total. Percent of total takes each data value, divides it by the normalizationTotal of all values, and then multiplies by 100 to turn it into a percentage.

normalizationType

inherited Property
Type
NormalizationType | null | undefined

Normalization type used to normalize data during binning. Some analytical methods require that data be normally distributed. When the data is skewed (the distribution is lopsided) you can transform the data to make it normal.

The following normalization types are supported:

ValueDescription
natural-logNatural logarithmic transformation can be used when the data has a positively skewed distribution and there are a few large values. If these large values are located in the dataset, the log transformation will help make the variances more constant and normalize the data.
logThe logarithmic transformation (base 10) is similar to the natural logarithmic transformation. It is used to reduce skewness, particularly in datasets with large values.
square-rootSquare root transformation is similar to a logarithmic transformation in that it reduces right skewness of a dataset. Unlike logarithmic transformations, square root transformations can be applied to zero.
percent-of-totalPercent of total takes each data value, divides it by the normalizationTotal of all values, and then multiplies by 100 to turn it into a percentage. If you don’t provide a normalizationTotal, it will be calculated automatically.
fieldDivides the data value by the value from the specified field. You must provide the normalizationField, and values of 0 are filtered out.

numBins

Property
Type
number | null | undefined

The number of bins to generate.

splitBy

autocast inherited Property
Type
AttributeBinsGrouping | null | undefined
Inherited from: BinParametersBase

The splitBy parameter divides data into separate bins for each unique value in the categorical field. Each category will have different bin boundaries based on the data distribution within that category. For example, when analyzing sales by region (e.g., Central, Northeast, etc.), splitBy will create separate bin ranges for each region, allowing the boundaries to adjust to the specific data distribution of each region. The splitBy parameter is useful when the distribution of values within each category (e.g., branch or region) differs significantly, and you want each category’s binning to reflect its unique data range.

Field with many unique values are not appropriate for splitting bins into multiple series.

Example
// create bins based on the SalesTotal field, split by the Branch field.
const binQuery = new AttributeBinsQuery({
binParameters: new AutoIntervalBinParameters({
numBins: 5, // the interval size for each bin
field: "SalesTotal",
splitBy: { // autocasts to AttributeBinsGrouping
type: "field",
value: "Branch"
}
})
});
const result = await layer.queryAttributeBins(binQuery);

stackBy

autocast inherited Property
Type
AttributeBinsGrouping | null | undefined
Inherited from: BinParametersBase

The stackBy parameter divides each bin into segments based on unique values from a categorical field, allowing you to compare multiple categories within the same bin while keeping the bin boundaries consistent across all categories. This enables you to visualize or analyze the distribution of categories stacked together within the same range of values. For example, with 3 bins based on total sales with ranges like $0 to $5000, $5001 to $10,000, and $10,001 to $15,000, setting stackBy = SalesRep will stack each sales rep's contribution within the same bin range. The bin boundaries remain the same, and each segment within the bin shows how individual categories contribute to the total frequency or value.

Field with many unique values are not appropriate for splitting bins into multiple series.

Example
// create bins based on the SalesTotal field, stacked by the Month field.
const binQuery = new AttributeBinsQuery({
binParameters: new AutoIntervalBinParameters({
numBins: 5, // the interval size for each bin
field: "SalesTotal",
stackBy: {
value: "EXTRACT(MONTH from invoiceDate)",
type: "expression",
valueType: "double",
alias: "Month"
}
})
});
const result = await layer.queryAttributeBins(binQuery);

start

Property
Type
number | Date | null | undefined

The start value of bins to generate. The value can be a number or a date.

type

readonly Property
Type
"auto-interval"

The type of bin parameters.

Methods

MethodSignatureClass
fromJSON
inherited static
fromJSON(json: any): any
clone
inherited
clone(): this
toJSON
inherited
toJSON(): any

fromJSON

inheritedstatic Method
Signature
fromJSON (json: any): any
Inherited from: JSONSupportMixin

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameters
ParameterTypeDescriptionRequired
json
any

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns
any

Returns a new instance of this class.

clone

inherited Method
Signature
clone (): this
Inherited from: ClonableMixin

Creates a deep clone of this object. Any properties that store values by reference will be assigned copies of the referenced values on the cloned instance.

Returns
this

A deep clone of the class instance that invoked this method.

toJSON

inherited Method
Signature
toJSON (): any
Inherited from: JSONSupportMixin

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.

Returns
any

The ArcGIS portal JSON representation of an instance of this class.