import React, { useEffect, useState } from 'react'; import { ResponsivePie } from '@nivo/pie'; import { queryAssets } from '../api/bbgo'; import { currencyColor } from '../src/utils'; import CardContent from '@mui/core/CardContent'; import Card from '@mui/core/Card'; import { makeStyles } from '@mui/core/styles'; function reduceAssetsBy(assets, field, minimum) { let as = []; let others = { id: 'others', labels: 'others', value: 0.0 }; for (let key in assets) { if (assets[key]) { let a = assets[key]; let value = a[field]; if (value < minimum) { others.value += value; } else { as.push({ id: a.currency, label: a.currency, color: currencyColor(a.currency), value: Math.round(value, 1), }); } } } return as; } const useStyles = makeStyles((theme) => ({ root: { margin: theme.spacing(1), }, cardContent: { height: 350, }, })); export default function TotalAssetsPie({ assets }) { const classes = useStyles(); return ( ); }