remove curve from chart
This commit is contained in:
parent
3d8f7aeb88
commit
c7535a60f8
|
@ -25,7 +25,7 @@ import { useTranslation } from 'react-i18next'
|
||||||
import { NoSymbolIcon } from '@heroicons/react/20/solid'
|
import { NoSymbolIcon } from '@heroicons/react/20/solid'
|
||||||
|
|
||||||
type RateCurveData = {
|
type RateCurveData = {
|
||||||
util: string
|
util: number
|
||||||
rate: number
|
rate: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,33 +49,30 @@ const RateCurveChart = ({ bank }: { bank: Bank | undefined }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const [currentRate, currentUtil] = useMemo(() => {
|
const [currentRate, currentUtil] = useMemo(() => {
|
||||||
if (!bank) return [0, '0']
|
if (!bank) return [0, 0]
|
||||||
const currentRate = bank.getDepositRateUi()
|
const currentRate = bank.getDepositRateUi()
|
||||||
const currentUtil = (
|
const currentUtil = (bank.uiBorrows() / bank.uiDeposits()) * 100
|
||||||
(bank.uiBorrows() / bank.uiDeposits()) *
|
|
||||||
100
|
|
||||||
).toString()
|
|
||||||
return [currentRate, currentUtil]
|
return [currentRate, currentUtil]
|
||||||
}, [bank])
|
}, [bank])
|
||||||
|
|
||||||
const rateCurveChartData = useMemo(() => {
|
const rateCurveChartData = useMemo(() => {
|
||||||
if (!bank) return []
|
if (!bank) return []
|
||||||
const defaults = [
|
const defaults = [
|
||||||
{ util: '0', rate: 0 },
|
{ util: 0, rate: 0 },
|
||||||
{
|
{
|
||||||
util: (bank.util0.toNumber() * 100).toString(),
|
util: bank.util0.toNumber() * 100,
|
||||||
rate: bank.rate0.toNumber() * 100,
|
rate: bank.rate0.toNumber() * 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
util: (bank.util1.toNumber() * 100).toString(),
|
util: bank.util1.toNumber() * 100,
|
||||||
rate: bank.rate1.toNumber() * 100,
|
rate: bank.rate1.toNumber() * 100,
|
||||||
},
|
},
|
||||||
{ util: '100', rate: bank.maxRate.toNumber() * 100 },
|
{ util: 100, rate: bank.maxRate.toNumber() * 100 },
|
||||||
]
|
]
|
||||||
if (currentRate && currentUtil) {
|
if (currentRate && currentUtil) {
|
||||||
defaults.push({ util: currentUtil, rate: currentRate })
|
defaults.push({ util: currentUtil, rate: currentRate })
|
||||||
}
|
}
|
||||||
return defaults.sort((a, b) => parseInt(a.util) - parseInt(b.util))
|
return defaults.sort((a, b) => a.util - b.util)
|
||||||
}, [bank, currentRate, currentUtil])
|
}, [bank, currentRate, currentUtil])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -177,7 +174,7 @@ const RateCurveChart = ({ bank }: { bank: Bank | undefined }) => {
|
||||||
</defs>
|
</defs>
|
||||||
<Area
|
<Area
|
||||||
isAnimationActive={false}
|
isAnimationActive={false}
|
||||||
type="monotone"
|
type="linear"
|
||||||
dataKey="rate"
|
dataKey="rate"
|
||||||
stroke={COLORS.UP[theme]}
|
stroke={COLORS.UP[theme]}
|
||||||
strokeWidth={1.5}
|
strokeWidth={1.5}
|
||||||
|
@ -194,6 +191,7 @@ const RateCurveChart = ({ bank }: { bank: Bank | undefined }) => {
|
||||||
}}
|
}}
|
||||||
tickLine={false}
|
tickLine={false}
|
||||||
tickFormatter={(d) => `${floorToDecimal(d, 2).toString()}%`}
|
tickFormatter={(d) => `${floorToDecimal(d, 2).toString()}%`}
|
||||||
|
type="number"
|
||||||
/>
|
/>
|
||||||
<YAxis
|
<YAxis
|
||||||
axisLine={false}
|
axisLine={false}
|
||||||
|
|
Loading…
Reference in New Issue