From b5dcf0c70f49826bf7b288f9df10ecb9e0951136 Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Thu, 20 Feb 2025 17:01:00 -0500 Subject: [PATCH] reverse data order --- .../Consensus/Home/HistoryIncreaseChart.tsx | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/explorer/src/components/Consensus/Home/HistoryIncreaseChart.tsx b/explorer/src/components/Consensus/Home/HistoryIncreaseChart.tsx index a62c8bf4..e7e72198 100644 --- a/explorer/src/components/Consensus/Home/HistoryIncreaseChart.tsx +++ b/explorer/src/components/Consensus/Home/HistoryIncreaseChart.tsx @@ -41,7 +41,7 @@ export const HistoryIncreaseChart: FC = ({ data, load // If all units are the same, return as is if (uniqueUnits.length === 1) { return { - data: mappedData, + data: mappedData.reverse(), unit: uniqueUnits[0], } } @@ -63,15 +63,17 @@ export const HistoryIncreaseChart: FC = ({ data, load ) return { - data: mappedData.map((d) => ({ - ...d, - increase: - d.unit === biggestUnit - ? d.increase - : d.increase / - (unitConversion[biggestUnit as keyof typeof unitConversion] / - unitConversion[d.unit as keyof typeof unitConversion]), - })), + data: mappedData + .map((d) => ({ + ...d, + increase: + d.unit === biggestUnit + ? d.increase + : d.increase / + (unitConversion[biggestUnit as keyof typeof unitConversion] / + unitConversion[d.unit as keyof typeof unitConversion]), + })) + .reverse(), unit: biggestUnit, } }, [data, timeFrame])