From b19599080f35adffe446c3d54a5bed4aaa324f19 Mon Sep 17 00:00:00 2001 From: Alan Treadway Date: Wed, 26 Feb 2025 17:09:18 +0000 Subject: [PATCH] Pre-emptive Charts bump fix - handle AgGradientFill cases. --- .../chartProxies/pie/pieChartProxy.ts | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/pie/pieChartProxy.ts b/packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/pie/pieChartProxy.ts index cbae0216513..0307f59d700 100644 --- a/packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/pie/pieChartProxy.ts +++ b/packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/pie/pieChartProxy.ts @@ -1,5 +1,7 @@ import type { AgDonutSeriesOptions, + AgFillType, + AgGradientFill, AgPieSeriesOptions, AgPolarChartOptions, AgPolarSeriesOptions, @@ -138,11 +140,26 @@ export class PieChartProxy extends ChartProxy(fills: T[], alpha: number): T[] { const Color = this.agChartsExports._Util.Color; return fills.map((fill) => { - const c = Color.fromString(fill); - return new Color(c.r, c.g, c.b, alpha).toHexString(); + if (typeof fill === 'string') { + const c = Color.fromString(fill); + return new Color(c.r, c.g, c.b, alpha).toHexString() as T; + } + + return { + ...(fill as AgGradientFill), + colorStops: fill.colorStops?.map((stop) => { + if (stop.color == null) return stop; + + const c = Color.fromString(stop.color); + return { + ...stop, + color: new Color(c.r, c.g, c.b, alpha).toHexString(), + }; + }), + } as T; }); } }