( [xMin, xMax]: Bounds, xValues: XValue[], xScale: XScale, timestampUnit: TimestampUnit, )
| 245 | : CATEGORY; |
| 246 | |
| 247 | export const getXScaleDomain = ( |
| 248 | [xMin, xMax]: Bounds, |
| 249 | xValues: XValue[], |
| 250 | xScale: XScale, |
| 251 | timestampUnit: TimestampUnit, |
| 252 | ): readonly [xMin?: XValue, xMax?: XValue] => { |
| 253 | const timestamps: number[] = []; |
| 254 | return xScale == LINEAR |
| 255 | ? [isNumber(xMin) ? xMin : undefined, isNumber(xMax) ? xMax : undefined] |
| 256 | : xScale == TIME |
| 257 | ? (arrayForEach(xValues, (xValue) => { |
| 258 | const timestamp = normalizeTimeValue(xValue, timestampUnit); |
| 259 | if (isFiniteNumber(timestamp)) { |
| 260 | arrayPush(timestamps, timestamp as number); |
| 261 | } |
| 262 | }), |
| 263 | arrayIsEmpty(timestamps) ? [] : getDomain(timestamps)) |
| 264 | : [xMin, xMax]; |
| 265 | }; |
| 266 | |
| 267 | export const normalizeTimeValue = ( |
| 268 | value: unknown, |
no test coverage detected
searching dependent graphs…