Crypto wallet
What each coin is worth and its share, its move over a day, and the whole on a ring. Good for portfolio apps and wallet summaries.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
import 'nervure/themes';
const spec = {
type: 'wallet',
format: { currency: 'EUR' },
data: [
{ name: 'Cedar', symbol: 'CDR', value: 7200, amount: 20.571, change: -5.2, cost: 7056 },
{ name: 'Nimbus', symbol: 'NMB', value: 800, amount: 7.619, change: 2.4, cost: 824 },
{ name: 'Quartz', symbol: 'QTZ', value: 667, amount: 3.161, change: -4.5, cost: 507 },
{ name: 'Harbor', symbol: 'HBR', value: 1450, amount: 58, change: 2.5, cost: 870 },
{ name: 'Stable coin', symbol: 'USDX', value: 620, amount: 2.967, change: 0, cost: 496 },
],
};
export default function Example() {
return <Chart spec={spec} style={{ height: 340 }} />;
}Or import this chart alone: what each import weighs.
Options
Beside the fields shared by every chart (title, format, heading, export…), type wallet takes:
/** A wallet: what each coin is worth, its share, its move over a day and against what it cost. */
interface WalletSpec extends Base {
type: 'wallet';
data: {
name: string;
symbol?: string;
/** Value now. */
value: number;
/** Coins held. */
amount?: number;
/** Change over a day, in %. */
change?: number;
/** What it cost. */
cost?: number;
color?: string;
}[];
onItemClick?: (name: string) => void;
}Style it
- Colours:
theme.palette,chart.setColor(name, colour), or--nervure-palettein your CSS. More - Marks:
[data-series="name"], parts:[data-part="axes"],legend,series. What you change is kept in exports. - Movement:
animation: falsedraws at once. More - Files:
chart.download('png'),svg,csv. More