fix(ui): extend Risk Plot gradient to cover full chart area (#9720)

This commit is contained in:
Alan Buscaglia
2026-01-05 15:34:17 +01:00
committed by GitHub
parent c6cc82c527
commit f31e230537

View File

@@ -277,16 +277,12 @@ export function ScatterPlot<T extends ScatterDataPoint = ScatterDataPoint>({
const providers = Object.keys(dataByProvider);
// Calculate domain for ReferenceArea
// For X axis: get max value from data (using the correct dataKey)
// For Y axis: use domain if provided, otherwise calculate from data
const xDataValues = data.length > 0 ? data.map((d) => d[xAxis.dataKey]) : [0];
const yDataValues = data.length > 0 ? data.map((d) => d[yAxis.dataKey]) : [0];
// ReferenceArea bounds - use very large values and let ifOverflow="hidden" clip to chart area
// This ensures the gradient always covers exactly the visible chart area regardless of data
const minX = xAxis.domain?.[0] ?? 0;
const maxX = xAxis.domain?.[1] ?? Math.max(...xDataValues) * 1.031;
const maxX = xAxis.domain?.[1] ?? Number.MAX_SAFE_INTEGER;
const minY = yAxis.domain?.[0] ?? 0;
const maxY = yAxis.domain?.[1] ?? Math.max(...yDataValues) * 1.031;
const maxY = yAxis.domain?.[1] ?? Number.MAX_SAFE_INTEGER;
const handleSelectPoint = (point: T) => {
if (onSelectPoint) {
@@ -342,7 +338,7 @@ export function ScatterPlot<T extends ScatterDataPoint = ScatterDataPoint>({
y1={minY}
y2={maxY}
fill={`url(#${gradientId})`}
ifOverflow="extendDomain"
ifOverflow="hidden"
/>
)}
<CartesianGrid