From c1d17dac4361af3b82f831b41e2cd7136d16aff2 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Fri, 25 Oct 2024 05:39:52 +0000 Subject: [PATCH] fix purple pie chart with single pool --- .../active-acceleration-box.component.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/components/acceleration/active-acceleration-box/active-acceleration-box.component.ts b/frontend/src/app/components/acceleration/active-acceleration-box/active-acceleration-box.component.ts index eae20f7e5..739760017 100644 --- a/frontend/src/app/components/acceleration/active-acceleration-box/active-acceleration-box.component.ts +++ b/frontend/src/app/components/acceleration/active-acceleration-box/active-acceleration-box.component.ts @@ -76,15 +76,21 @@ export class ActiveAccelerationBox implements OnChanges { acceleratingPools.forEach((poolId, index) => { const pool = pools[poolId]; const poolShare = ((pool.lastEstimatedHashrate / this.miningStats.lastEstimatedHashrate) * 100).toFixed(1); + let color = 'white'; + if (index >= firstSignificantPool) { + if (numSignificantPools > 1) { + color = toRGB(lighten({ r: 147, g: 57, b: 244 }, 1 - (index - firstSignificantPool) / Math.max((numSignificantPools - 1), 1))); + } else { + color = toRGB({ r: 147, g: 57, b: 244 }); + } + } data.push(getDataItem( pool.lastEstimatedHashrate, - index >= firstSignificantPool - ? toRGB(lighten({ r: 147, g: 57, b: 244 }, 1 - (index - firstSignificantPool) / (numSignificantPools - 1))) - : 'white', + color, `${pool.name} (${poolShare}%)`, true, ) as PieSeriesOption); - }) + }); this.acceleratedByPercentage = ((totalAcceleratedHashrate / this.miningStats.lastEstimatedHashrate) * 100).toFixed(1) + '%'; const notAcceleratedByPercentage = ((1 - (totalAcceleratedHashrate / this.miningStats.lastEstimatedHashrate)) * 100).toFixed(1) + '%'; data.push(getDataItem(