Documentation / @ripl/charts / positiveNegativeExtent
Function: positiveNegativeExtent() ​
positiveNegativeExtent<
TSeries,TData>(series,data,getValue): [number,number]
Defined in: charts/src/core/data.ts:146
Computes the value extent [min, max] of independently stacked positive and negative totals: the span a stacked bar chart covers when, per item, positive and negative values accumulate from the baseline in opposite directions. Both bounds seed at 0, so an all-positive (or all-negative) dataset keeps a zero baseline.
Type Parameters ​
| Type Parameter | Description |
|---|---|
TSeries | The series type. |
TData | The data-item type. |
Parameters ​
| Parameter | Type | Description |
|---|---|---|
series | TSeries[] | The series that stack together. |
data | TData[] | The dataset iterated per item. |
getValue | (series, item) => number | Resolves a series' numeric value at a data item. |
Returns ​
[number, number]
The [min, max] extent covering every item's positive and negative stacked totals.