( seriesConfigs: ReadonlyArray<ResolvedBarSeriesConfig>, yScale: LinearScale, )
| 349 | }; |
| 350 | |
| 351 | export function inferPlotHeightPxForBarHitTesting( |
| 352 | seriesConfigs: ReadonlyArray<ResolvedBarSeriesConfig>, |
| 353 | yScale: LinearScale, |
| 354 | ): number { |
| 355 | // We don't have direct access to the scale range endpoints, so infer the plot height in range-space. |
| 356 | // In the common ChartGPU interaction setup, yScale.range(plotHeightCss, 0), so max(scaledY) should |
| 357 | // approximate plotHeightCss (or be <= plotHeightCss if axis min/max are overridden). |
| 358 | let maxY = 0; |
| 359 | for (let s = 0; s < seriesConfigs.length; s++) { |
| 360 | const data = seriesConfigs[s].data; |
| 361 | for (let i = 0; i < data.length; i++) { |
| 362 | const { y } = getPointXY(data[i]); |
| 363 | if (!Number.isFinite(y)) continue; |
| 364 | const py = yScale.scale(y); |
| 365 | if (Number.isFinite(py) && py > maxY) maxY = py; |
| 366 | } |
| 367 | } |
| 368 | return Math.max(0, maxY); |
| 369 | } |
| 370 | |
| 371 | export function computeBaselineDomainAndPx( |
| 372 | seriesConfigs: ReadonlyArray<ResolvedBarSeriesConfig>, |
no test coverage detected