Documentation / @ripl/charts / computeStackOffset
Function: computeStackOffset() ​
computeStackOffset<
TSeries,TData>(series,current,item,getValue,currentIndex?):number
Defined in: charts/src/core/data.ts:109
Computes the stacked baseline offset for a series at a given data item. Positive and negative values stack independently so diverging stacks render correctly. Series earlier in the array sit closer to the baseline.
Type Parameters ​
| Type Parameter |
|---|
TSeries |
TData |
Parameters ​
| Parameter | Type | Description |
|---|---|---|
series | TSeries[] | The series that stack together, in stacking order. |
current | TSeries | The series to compute the offset for. |
item | TData | The data item being stacked. |
getValue | (series, item) => number | Resolves a series' numeric value at a data item. |
currentIndex | number | current's index in series, when the caller already holds it. Defaults to an indexOf scan, which is quadratic when the offset is computed for every series in turn. |
Returns ​
number