Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions api/src/stats/stats.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ export class StatsService {
individualsCapital: supplyAndCapital.individualsCapital,
communityCapital: supplyAndCapital.communityCapital,
communityWalletsBalanceBreakdown: communityWalletsBalanceBreakdown,
rewardsOverTime: pofValues.nominalRewardOverTime, // net rewards? also available on the pofValues object
clearingBidoverTime: pofValues.clearingBidOverTime, // net rewards? also available on the pofValues object
rewardsOverTime: pofValues.nominalRewardOverTime,
clearingBidOverTime: pofValues.clearingBidOverTime,
netRewardOverTime: pofValues.netRewardOverTime,
liquidSupplyConcentration: liquidSupplyConcentration,
lockedSupplyConcentration: lockedSupplyConcentration,

Expand All @@ -145,6 +146,7 @@ export class StatsService {
infrastructureEscrow,
lockedCoins,
};

return res;
}

Expand Down
3 changes: 2 additions & 1 deletion api/src/stats/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export interface Stats {
communityCapital: NameValue[];
communityWalletsBalanceBreakdown: NameValue[];
rewardsOverTime: TimestampValue[];
clearingBidoverTime: TimestampValue[];
clearingBidOverTime: TimestampValue[];
netRewardOverTime: TimestampValue[];
liquidSupplyConcentration: BinRange[];
lockedSupplyConcentration: {
accountsLocked: BinRange[];
Expand Down
5 changes: 3 additions & 2 deletions web-app/src/modules/core/routes/Stats/ChartComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ interface Props {
title: string;
type: string;
data: any;
showHorizontalLine?: boolean;
}

const ChartComponent: FC<Props> = ({ type, data, title }) => {
const ChartComponent: FC<Props> = ({ type, data, title, showHorizontalLine }) => {
const chart = (() => {
switch (type) {
case 'BarChart':
return <BarChart data={data} title={title} />;
case 'PieChart':
return <PieChart data={data} title={title} />;
case 'LineChart':
return <LineChart data={data} title={title} />;
return <LineChart data={data} title={title} showHorizontalLine={showHorizontalLine} />;
case 'LineAndBarChart':
return <LineAndBarChart data={data} title={title} />;
case 'LineAndAreaChart':
Expand Down
12 changes: 10 additions & 2 deletions web-app/src/modules/core/routes/Stats/Stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,21 @@ const Coinstats = () => {
<dl className="mt-5 grid grid-cols-1 gap-5 lg:grid-cols-2">
<ChartComponent
type="LineChart"
title="Rewards Over Time"
title="Gross Rewards Over Time"
data={data.rewardsOverTime}
/>
<ChartComponent
type="LineChart"
title="Clearing bid Over Time"
data={data.clearingBidoverTime}
data={data.clearingBidOverTime}
/>
</dl>
<dl className="w-full mt-5 grid grid-cols-1 gap-5">
<ChartComponent
type="LineChart"
title="Net Rewards Over Time"
data={data.netRewardOverTime}
showHorizontalLine={true}
/>
</dl>
</div>
Expand Down
40 changes: 23 additions & 17 deletions web-app/src/modules/core/routes/Stats/components/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import ChartContainer from './ChartContainer';
interface Props {
title: string;
data: { value: number; timestamp: number }[];
showHorizontalLine?: boolean;
}

const LineChart: FC<Props> = ({ data, title }) => {
const LineChart: FC<Props> = ({ data, title, showHorizontalLine = false }) => {
const option = {
animation: false,
tooltip: {
Expand Down Expand Up @@ -41,30 +42,14 @@ const LineChart: FC<Props> = ({ data, title }) => {
axisTick: {
alignWithLabel: true,
},
axisLine: {
lineStyle: {
// color: '#E8595C'
},
},
},
yAxis: {
type: 'value',
axisLine: {
lineStyle: {
// color: '#E8595C'
},
},
splitLine: {
lineStyle: {
// color: '#ced6e0'
},
},
},
series: [
{
data: data.map((item) => item.value),
type: 'line',
smooth: false,
symbol: 'circle',
symbolSize: 8,
itemStyle: {
Expand All @@ -75,6 +60,27 @@ const LineChart: FC<Props> = ({ data, title }) => {
lineStyle: {
width: 3,
},
markLine: showHorizontalLine
? {
data: [
{
yAxis: 35000,
label: {
formatter: '35K',
fontSize: 15,
// fontWeight: 'bold',
},
},
],
lineStyle: {
type: 'dashed',
color: 'red',
width: 1.2,
},
symbol: ['none', 'diamond'],
symbolSize: 7,
}
: undefined,
},
],
};
Expand Down