Core
Last updated
Last updated
Package | Version | Downloads |
---|---|---|
Set of common functions, to be used mostly by other packages. You won’t usually consume this package directly, but when using AggregationTypes
for widgets or when creating custom widgets.
Tip: The computations performed internally by widgets use these functions. They can be useful in the context of new custom widgets (for example using a different charting library)
Contains a set of basic aggregation functions (count, min, max, sum, and average), used automatically for widgets and layers, see AggregationTypes. Functions are applicable to numbers and also objects using a numeric property.
Input:
Param | Type | Description |
---|---|---|
Returns: Object
- An object with Aggregation functions, which keys are every AggregationTypes
values
Example:
Makes groups from features based in a column (keysColumn
) and applying an operation
to the numeric values in a predefined column (valuesColumn
).
Input:
Returns: Array
- Grouped values
Example:
Categorizes numeric values as a histogram from a set of features, having the option of just calculating the frequency (with COUNT operation) or an aggregated operation on the features inside the bin (e.g., SUM).
Input:
Returns: Array
- Histogram data for each bin, derived from ticks
Example:
Receives an array of features and the properties that will be used for each axis, checks that properties are valid and returns a formatted array.
Input:
Returns: Array
- Formatted array.
Example:
Enum for the different types of aggregations, available for widgets.
Options:
COUNT
SUM
AVG
MIN
MAX
Example:
Param | Type | Default | Description |
---|---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
data
Array
Features for calculations (plain objects with properties)
valuesColumn
string
Quantitative column for grouping (the name of a numeric property in the object)
keysColumn
string
Qualitative column for grouping (the name of a string property in the object)
operation
string
Operation for groups calculations, see AggregationTypes
features
Array
Features for calculations (plain objects with properties)
columnName
string
Quantitative column for calculations (the name of a number property in the object)
ticks
Array
Array of numbers to build intervals (eg 1, 5, 10 will defines 4 intervals: <1, 1 to 5, 5 to 10 and >10)
operation
string
Operation for groups calculations, see AggregationTypes
features
Array
Features
xAxisColumn
string
Property containing values for the X axis.
yAxisColumn
string
Property containing values for the Y axis.
@carto/react-core
values
Array
Array of numbers or objects with a numerical property
[key]
string
(optional). When using objects, name of the property to use for calculations