Skip to content

Commit

Permalink
reverse data order
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-aurele-besner committed Feb 20, 2025
1 parent 2462d42 commit b5dcf0c
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions explorer/src/components/Consensus/Home/HistoryIncreaseChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const HistoryIncreaseChart: FC<HistoryIncreaseChartProps> = ({ data, load
// If all units are the same, return as is
if (uniqueUnits.length === 1) {
return {
data: mappedData,
data: mappedData.reverse(),
unit: uniqueUnits[0],
}
}
Expand All @@ -63,15 +63,17 @@ export const HistoryIncreaseChart: FC<HistoryIncreaseChartProps> = ({ 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])
Expand Down

0 comments on commit b5dcf0c

Please sign in to comment.