From 2dc47422a8a673fce6aaf1d01fe15ff1476175eb Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Sat, 15 Feb 2025 18:46:32 +0700 Subject: [PATCH] feat(sb): add story for treemap chart --- .../treemap-chart.component.stories.ts | 338 ++++++++++++++++++ 1 file changed, 338 insertions(+) create mode 100644 libs/ui/src/lib/treemap-chart/treemap-chart.component.stories.ts diff --git a/libs/ui/src/lib/treemap-chart/treemap-chart.component.stories.ts b/libs/ui/src/lib/treemap-chart/treemap-chart.component.stories.ts new file mode 100644 index 000000000..c508a6923 --- /dev/null +++ b/libs/ui/src/lib/treemap-chart/treemap-chart.component.stories.ts @@ -0,0 +1,338 @@ +import { CommonModule } from '@angular/common'; +import { moduleMetadata } from '@storybook/angular'; +import type { Meta, StoryObj } from '@storybook/angular'; +import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; + +import { GfTreemapChartComponent } from './treemap-chart.component'; + +export default { + title: 'Treemap Chart', + component: GfTreemapChartComponent, + decorators: [ + moduleMetadata({ + imports: [CommonModule, NgxSkeletonLoaderModule] + }) + ], + argTypes: { + colorScheme: { + control: { + type: 'select' + }, + options: ['DARK', 'LIGHT'] + } + } +} as Meta; + +type Story = StoryObj; + +export const Default: Story = { + args: { + baseCurrency: 'USD', + colorScheme: 'LIGHT', + cursor: 'pointer', + dateRange: 'max', + holdings: [ + { + allocationInPercentage: 0.04297389794222121, + countries: [], + currency: 'USD', + dataSource: 'EOD_HISTORICAL_DATA', + dateOfFirstActivity: new Date('2021-11-30T23:00:00.000Z'), + dividend: 0, + grossPerformance: 3856, + grossPerformancePercent: 0.46047289228564603, + grossPerformancePercentWithCurrencyEffect: 0.46047289228564603, + grossPerformanceWithCurrencyEffect: 3856, + holdings: [], + investment: 8374, + marketPrice: 244.6, + name: 'Apple Inc', + netPerformance: 3855, + netPerformancePercent: 0.460353475041796, + netPerformancePercentWithCurrencyEffect: 0.33517397382382147, + netPerformanceWithCurrencyEffect: 3070.145, + quantity: 50, + sectors: [], + symbol: 'AAPL.US', + transactionCount: 1, + valueInBaseCurrency: 12230 + }, + { + allocationInPercentage: 0.02376468566885821, + countries: [], + currency: 'EUR', + dataSource: 'YAHOO', + dateOfFirstActivity: new Date('2021-04-22T22:00:00.000Z'), + dividend: 192, + grossPerformance: 2226.700251889169, + grossPerformancePercent: 0.49083842309827874, + grossPerformancePercentWithCurrencyEffect: 0.29306136948826367, + grossPerformanceWithCurrencyEffect: 1532.8272791336772, + holdings: [], + investment: 4536.523929471033, + marketPrice: 322.2, + name: 'Allianz SE', + netPerformance: 2222.2921914357685, + netPerformancePercent: 0.48986674069961134, + netPerformancePercentWithCurrencyEffect: 0.2758025127480495, + netPerformanceWithCurrencyEffect: 1462.071288352983, + quantity: 20, + sectors: [], + symbol: 'ALV.DE', + transactionCount: 2, + valueInBaseCurrency: 6763.224181360202 + }, + { + allocationInPercentage: 0.08035381015067167, + countries: [], + currency: 'USD', + dataSource: 'YAHOO', + dateOfFirstActivity: new Date('2018-10-01T00:00:00.000Z'), + dividend: 0, + grossPerformance: 12758.05, + grossPerformancePercent: 1.2619300787837724, + grossPerformancePercentWithCurrencyEffect: 1.2619300787837724, + grossPerformanceWithCurrencyEffect: 12758.05, + holdings: [], + investment: 10109.95, + marketPrice: 228.68, + name: 'Amazon.com, Inc.', + netPerformance: 12677.26, + netPerformancePercent: 1.253938941339967, + netPerformancePercentWithCurrencyEffect: 0.3467608709659129, + netPerformanceWithCurrencyEffect: 5887.99969482422, + quantity: 100, + sectors: [], + symbol: 'AMZN', + transactionCount: 1, + valueInBaseCurrency: 22868 + }, + { + allocationInPercentage: 0.1924813257324291, + countries: [], + currency: 'USD', + dataSource: 'COINGECKO', + dateOfFirstActivity: new Date('2017-08-15T22:00:00.000Z'), + dividend: 0, + grossPerformance: 52778.5219966, + grossPerformancePercent: 26.389260998300003, + grossPerformancePercentWithCurrencyEffect: 26.389260998300003, + grossPerformanceWithCurrencyEffect: 52778.5219966, + holdings: [], + investment: 1999.9999999999998, + marketPrice: 97563, + name: 'Bitcoin', + netPerformance: 52748.6219966, + netPerformancePercent: 26.3743109983, + netPerformancePercentWithCurrencyEffect: 0.8863678327863547, + netPerformanceWithCurrencyEffect: 25739.370117251725, + quantity: 0.5614682, + sectors: [], + symbol: 'bitcoin', + transactionCount: 1, + valueInBaseCurrency: 54778.5219966 + }, + { + allocationInPercentage: 0.007375755949366297, + countries: [], + currency: 'EUR', + dataSource: 'MANUAL', + dateOfFirstActivity: new Date('2021-01-31T23:00:00.000Z'), + dividend: 11.45, + grossPerformance: 0, + grossPerformancePercent: 0, + grossPerformancePercentWithCurrencyEffect: -0.12473204800811313, + grossPerformanceWithCurrencyEffect: -258.2576430160448, + holdings: [], + investment: 2099.0764063811926, + marketPrice: 1, + name: 'Bondora Go & Grow', + netPerformance: 0, + netPerformancePercent: 0, + netPerformancePercentWithCurrencyEffect: -0.02592359361880765, + netPerformanceWithCurrencyEffect: -55.8637940282462, + quantity: 2000, + sectors: [], + symbol: 'BONDORA_GO_AND_GROW', + transactionCount: 5, + valueInBaseCurrency: 2099.0764063811926 + }, + { + allocationInPercentage: 0.07784474266697115, + countries: [], + currency: 'CHF', + dataSource: 'MANUAL', + dateOfFirstActivity: new Date('2021-04-01T00:00:00.000Z'), + dividend: 0, + grossPerformance: 4550.843985045582, + grossPerformancePercent: 0.3632455413393694, + grossPerformancePercentWithCurrencyEffect: 0.4204922012941791, + grossPerformanceWithCurrencyEffect: 5107.057936556927, + holdings: [], + investment: 17603.097090932337, + marketPrice: 188.22, + name: 'frankly Extreme 95 Index', + netPerformance: 4550.843985045582, + netPerformancePercent: 0.3632455413393694, + netPerformancePercentWithCurrencyEffect: 0.15268708552686547, + netPerformanceWithCurrencyEffect: 2934.5524369077702, + quantity: 105.87328656807, + sectors: [], + symbol: 'FRANKLY95P', + transactionCount: 6, + valueInBaseCurrency: 22153.941075977917 + }, + { + allocationInPercentage: 0.043054364194296174, + countries: [], + currency: 'USD', + dataSource: 'YAHOO', + dateOfFirstActivity: new Date('2023-01-03T00:00:00.000Z'), + dividend: 0, + grossPerformance: 5065.5, + grossPerformancePercent: 0.7047750229568411, + grossPerformancePercentWithCurrencyEffect: 0.7047750229568411, + grossPerformanceWithCurrencyEffect: 5065.5, + holdings: [], + investment: 7187.4, + marketPrice: 408.43, + name: 'Microsoft Corporation', + netPerformance: 5065.5, + netPerformancePercent: 0.7047750229568411, + netPerformancePercentWithCurrencyEffect: 0.004599573132220648, + netPerformanceWithCurrencyEffect: 56.100073242186, + quantity: 30, + sectors: [], + symbol: 'MSFT', + transactionCount: 1, + valueInBaseCurrency: 12252.9 + }, + { + allocationInPercentage: 0.18755312972722804, + countries: [], + currency: 'USD', + dataSource: 'YAHOO', + dateOfFirstActivity: new Date('2017-01-03T00:00:00.000Z'), + dividend: 0, + grossPerformance: 51227.500000005, + grossPerformancePercent: 23.843379101756675, + grossPerformancePercentWithCurrencyEffect: 23.843379101756675, + grossPerformanceWithCurrencyEffect: 51227.500000005, + holdings: [], + investment: 2148.499999995, + marketPrice: 355.84, + name: 'Tesla, Inc.', + netPerformance: 51197.500000005, + netPerformancePercent: 23.829415871596066, + netPerformancePercentWithCurrencyEffect: 0.7752058140059775, + netPerformanceWithCurrencyEffect: 23308.50045776367, + quantity: 150, + sectors: [], + symbol: 'TSLA', + transactionCount: 1, + valueInBaseCurrency: 53376 + }, + { + allocationInPercentage: 0.05303042254652514, + countries: [], + currency: 'USD', + dataSource: 'YAHOO', + dateOfFirstActivity: new Date('2019-03-01T00:00:00.000Z'), + dividend: 0, + grossPerformance: 6845.8, + grossPerformancePercent: 1.0165805525150873, + grossPerformancePercentWithCurrencyEffect: 1.0165805525150873, + grossPerformanceWithCurrencyEffect: 6845.8, + holdings: [], + investment: 8246.2, + marketPrice: 301.84, + name: 'Vanguard Total Stock Market Index Fund ETF Shares', + netPerformance: 6746.3, + netPerformancePercent: 1.0018051040685578, + netPerformancePercentWithCurrencyEffect: 0.208471773378915, + netPerformanceWithCurrencyEffect: 2603.499786376955, + quantity: 50, + sectors: [], + symbol: 'VTI', + transactionCount: 5, + valueInBaseCurrency: 15092 + }, + { + allocationInPercentage: 0.08362477479211206, + countries: [], + currency: 'CHF', + dataSource: 'YAHOO', + dateOfFirstActivity: new Date('2018-03-01T00:00:00.000Z'), + dividend: 0, + grossPerformance: 6462.42356864925, + grossPerformancePercent: 0.5464045087628423, + grossPerformancePercentWithCurrencyEffect: 0.6283507532327138, + grossPerformanceWithCurrencyEffect: 7121.935580698947, + holdings: [], + investment: 17336.464702612564, + marketPrice: 129.74, + name: 'Vanguard FTSE All-World UCITS ETF', + netPerformance: 6373.040578098944, + netPerformancePercent: 0.5388470856808387, + netPerformancePercentWithCurrencyEffect: 0.17446772990637183, + netPerformanceWithCurrencyEffect: 3535.3359698639256, + quantity: 165, + sectors: [], + symbol: 'VWRL.SW', + transactionCount: 5, + valueInBaseCurrency: 23798.888271261814 + }, + { + allocationInPercentage: 0.03263910303018637, + countries: [], + currency: 'EUR', + dataSource: 'YAHOO', + dateOfFirstActivity: new Date('2021-08-19T00:00:00.000Z'), + dividend: 0, + grossPerformance: 3112.7991183879094, + grossPerformancePercent: 0.5040147846036197, + grossPerformancePercentWithCurrencyEffect: 0.3516875105542396, + grossPerformanceWithCurrencyEffect: 2416.799201046856, + holdings: [], + investment: 6176.007556675063, + marketPrice: 118.005, + name: 'Xtrackers MSCI World UCITS ETF 1C', + netPerformance: 3081.4179261125105, + netPerformancePercent: 0.4989336392216841, + netPerformancePercentWithCurrencyEffect: 0.20279057467326012, + netPerformanceWithCurrencyEffect: 1566.0934524503903, + quantity: 75, + sectors: [], + symbol: 'XDWD.DE', + transactionCount: 1, + valueInBaseCurrency: 9288.806675062973 + }, + { + allocationInPercentage: 0.17530398759913457, + countries: [], + currency: 'USD', + dataSource: 'MANUAL', + dateOfFirstActivity: new Date('2021-04-01T00:00:00.000Z'), + dividend: 0, + grossPerformance: 0, + grossPerformancePercent: 0, + grossPerformancePercentWithCurrencyEffect: 0, + grossPerformanceWithCurrencyEffect: 0, + holdings: [], + investment: 49890, + marketPrice: 0, + name: 'USD', + netPerformance: 0, + netPerformancePercent: 0, + netPerformancePercentWithCurrencyEffect: 0, + netPerformanceWithCurrencyEffect: 0, + quantity: 0, + sectors: [], + symbol: 'USD', + transactionCount: 0, + valueInBaseCurrency: 49890 + } + ], + locale: 'en-US' + } +};