Browse Source

Feature/improve labels of line chart components (#5162)

* Improve labels

* Update changelog
pull/5163/head
Thomas Kaul 1 week ago
committed by GitHub
parent
commit
afaf783afb
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      CHANGELOG.md
  2. 2
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts
  3. 4
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html
  4. 3
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts
  5. 6
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html
  6. 2
      apps/client/src/app/components/home-market/home-market.html
  7. 1
      apps/client/src/app/components/home-overview/home-overview.component.ts
  8. 2
      apps/client/src/app/components/home-overview/home-overview.html
  9. 2
      apps/client/src/app/components/markets/markets.html
  10. 2
      libs/ui/src/lib/benchmark/benchmark-detail-dialog/benchmark-detail-dialog.html
  11. 4
      libs/ui/src/lib/line-chart/line-chart.component.stories.ts
  12. 4
      libs/ui/src/lib/line-chart/line-chart.component.ts

2
CHANGELOG.md

@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Improved the label for asset profiles with `MANUAL` data source in the chart of the asset profile details dialog in the admin control panel
- Improved the label for asset profiles with `MANUAL` data source in the chart of the holding detail dialog
- Improved the language localization for Chinese (`zh`) - Improved the language localization for Chinese (`zh`)
- Improved the language localization for Dutch (`nl`) - Improved the language localization for Dutch (`nl`)
- Improved the language localization for French (`fr`) - Improved the language localization for French (`fr`)

2
apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts

@ -49,6 +49,7 @@ import {
Prisma, Prisma,
SymbolProfile SymbolProfile
} from '@prisma/client'; } from '@prisma/client';
import { isUUID } from 'class-validator';
import { format } from 'date-fns'; import { format } from 'date-fns';
import { StatusCodes } from 'http-status-codes'; import { StatusCodes } from 'http-status-codes';
import { addIcons } from 'ionicons'; import { addIcons } from 'ionicons';
@ -144,6 +145,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
public isBenchmark = false; public isBenchmark = false;
public isDataGatheringEnabled: boolean; public isDataGatheringEnabled: boolean;
public isEditAssetProfileIdentifierMode = false; public isEditAssetProfileIdentifierMode = false;
public isUUID = isUUID;
public marketDataItems: MarketData[] = []; public marketDataItems: MarketData[] = [];
public modeValues = [ public modeValues = [

4
apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html

@ -72,10 +72,12 @@
[colorScheme]="user?.settings?.colorScheme" [colorScheme]="user?.settings?.colorScheme"
[historicalDataItems]="historicalDataItems" [historicalDataItems]="historicalDataItems"
[isAnimated]="true" [isAnimated]="true"
[label]="
isUUID(data.symbol) ? (assetProfile?.name ?? data.symbol) : data.symbol
"
[locale]="data.locale" [locale]="data.locale"
[showXAxis]="true" [showXAxis]="true"
[showYAxis]="true" [showYAxis]="true"
[symbol]="data.symbol"
/> />
<div class="mb-3"> <div class="mb-3">
<mat-accordion class="my-3"> <mat-accordion class="my-3">

3
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts

@ -49,6 +49,7 @@ import { MatTabsModule } from '@angular/material/tabs';
import { Router, RouterModule } from '@angular/router'; import { Router, RouterModule } from '@angular/router';
import { IonIcon } from '@ionic/angular/standalone'; import { IonIcon } from '@ionic/angular/standalone';
import { Account, MarketData, Tag } from '@prisma/client'; import { Account, MarketData, Tag } from '@prisma/client';
import { isUUID } from 'class-validator';
import { format, isSameMonth, isToday, parseISO } from 'date-fns'; import { format, isSameMonth, isToday, parseISO } from 'date-fns';
import { addIcons } from 'ionicons'; import { addIcons } from 'ionicons';
import { import {
@ -101,6 +102,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
public assetSubClass: string; public assetSubClass: string;
public averagePrice: number; public averagePrice: number;
public benchmarkDataItems: LineChartItem[]; public benchmarkDataItems: LineChartItem[];
public benchmarkLabel = $localize`Average Unit Price`;
public countries: { public countries: {
[code: string]: { name: string; value: number }; [code: string]: { name: string; value: number };
}; };
@ -116,6 +118,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
public historicalDataItems: LineChartItem[]; public historicalDataItems: LineChartItem[];
public investmentInBaseCurrencyWithCurrencyEffect: number; public investmentInBaseCurrencyWithCurrencyEffect: number;
public investmentInBaseCurrencyWithCurrencyEffectPrecision = 2; public investmentInBaseCurrencyWithCurrencyEffectPrecision = 2;
public isUUID = isUUID;
public marketDataItems: MarketData[] = []; public marketDataItems: MarketData[] = [];
public marketPrice: number; public marketPrice: number;
public marketPriceMax: number; public marketPriceMax: number;

6
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html

@ -21,18 +21,20 @@
</div> </div>
<gf-line-chart <gf-line-chart
benchmarkLabel="Average Unit Price"
class="mb-4" class="mb-4"
[benchmarkDataItems]="benchmarkDataItems" [benchmarkDataItems]="benchmarkDataItems"
[benchmarkLabel]="benchmarkLabel"
[colorScheme]="data.colorScheme" [colorScheme]="data.colorScheme"
[currency]="SymbolProfile?.currency" [currency]="SymbolProfile?.currency"
[historicalDataItems]="historicalDataItems" [historicalDataItems]="historicalDataItems"
[isAnimated]="true" [isAnimated]="true"
[label]="
isUUID(data.symbol) ? (SymbolProfile?.name ?? data.symbol) : data.symbol
"
[locale]="data.locale" [locale]="data.locale"
[showGradient]="true" [showGradient]="true"
[showXAxis]="true" [showXAxis]="true"
[showYAxis]="true" [showYAxis]="true"
[symbol]="data.symbol"
/> />
<mat-tab-group <mat-tab-group

2
apps/client/src/app/components/home-market/home-market.html

@ -8,7 +8,7 @@
</div> </div>
<gf-line-chart <gf-line-chart
class="mb-3" class="mb-3"
symbol="Fear & Greed Index" label="Fear & Greed Index"
[colorScheme]="user?.settings?.colorScheme" [colorScheme]="user?.settings?.colorScheme"
[historicalDataItems]="historicalDataItems" [historicalDataItems]="historicalDataItems"
[isAnimated]="true" [isAnimated]="true"

1
apps/client/src/app/components/home-overview/home-overview.component.ts

@ -36,6 +36,7 @@ export class HomeOverviewComponent implements OnDestroy, OnInit {
public isAllTimeLow: boolean; public isAllTimeLow: boolean;
public isLoadingPerformance = true; public isLoadingPerformance = true;
public performance: PortfolioPerformance; public performance: PortfolioPerformance;
public performanceLabel = $localize`Performance`;
public precision = 2; public precision = 2;
public routerLinkAccounts = internalRoutes.accounts.routerLink; public routerLinkAccounts = internalRoutes.accounts.routerLink;
public routerLinkPortfolio = internalRoutes.portfolio.routerLink; public routerLinkPortfolio = internalRoutes.portfolio.routerLink;

2
apps/client/src/app/components/home-overview/home-overview.html

@ -65,12 +65,12 @@
<div class="chart-container mx-auto position-relative"> <div class="chart-container mx-auto position-relative">
<gf-line-chart <gf-line-chart
class="position-absolute" class="position-absolute"
symbol="Performance"
unit="%" unit="%"
[colorScheme]="user?.settings?.colorScheme" [colorScheme]="user?.settings?.colorScheme"
[hidden]="historicalDataItems?.length === 0" [hidden]="historicalDataItems?.length === 0"
[historicalDataItems]="historicalDataItems" [historicalDataItems]="historicalDataItems"
[isAnimated]="user?.settings?.dateRange === '1d' ? false : true" [isAnimated]="user?.settings?.dateRange === '1d' ? false : true"
[label]="performanceLabel"
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"
[ngClass]="{ 'pr-3': deviceType === 'mobile' }" [ngClass]="{ 'pr-3': deviceType === 'mobile' }"
[showGradient]="true" [showGradient]="true"

2
apps/client/src/app/components/markets/markets.html

@ -18,7 +18,7 @@
</div> </div>
<gf-line-chart <gf-line-chart
class="mb-3" class="mb-3"
symbol="Fear & Greed Index" label="Fear & Greed Index"
[colorScheme]="user?.settings?.colorScheme" [colorScheme]="user?.settings?.colorScheme"
[historicalDataItems]="historicalDataItems" [historicalDataItems]="historicalDataItems"
[isAnimated]="true" [isAnimated]="true"

2
libs/ui/src/lib/benchmark/benchmark-detail-dialog/benchmark-detail-dialog.html

@ -25,11 +25,11 @@
[colorScheme]="data.colorScheme" [colorScheme]="data.colorScheme"
[historicalDataItems]="historicalDataItems" [historicalDataItems]="historicalDataItems"
[isAnimated]="true" [isAnimated]="true"
[label]="data.symbol"
[locale]="data.locale" [locale]="data.locale"
[showGradient]="true" [showGradient]="true"
[showXAxis]="true" [showXAxis]="true"
[showYAxis]="true" [showYAxis]="true"
[symbol]="data.symbol"
/> />
</div> </div>
</div> </div>

4
libs/ui/src/lib/line-chart/line-chart.component.stories.ts

@ -229,6 +229,8 @@ export const Simple: Story = {
value: 86666.03082624623 value: 86666.03082624623
} }
], ],
isAnimated: true isAnimated: true,
label: 'Net Worth',
unit: 'USD'
} }
}; };

4
libs/ui/src/lib/line-chart/line-chart.component.ts

@ -54,13 +54,13 @@ export class GfLineChartComponent
@Input() currency: string; @Input() currency: string;
@Input() historicalDataItems: LineChartItem[]; @Input() historicalDataItems: LineChartItem[];
@Input() isAnimated = false; @Input() isAnimated = false;
@Input() label: string;
@Input() locale = getLocale(); @Input() locale = getLocale();
@Input() showGradient = false; @Input() showGradient = false;
@Input() showLegend = false; @Input() showLegend = false;
@Input() showLoader = true; @Input() showLoader = true;
@Input() showXAxis = false; @Input() showXAxis = false;
@Input() showYAxis = false; @Input() showYAxis = false;
@Input() symbol: string;
@Input() unit: string; @Input() unit: string;
@Input() yMax: number; @Input() yMax: number;
@Input() yMaxLabel: string; @Input() yMaxLabel: string;
@ -162,7 +162,7 @@ export class GfLineChartComponent
borderWidth: 2, borderWidth: 2,
data: marketPrices, data: marketPrices,
fill: true, fill: true,
label: this.symbol, label: this.label,
pointRadius: 0 pointRadius: 0
} }
] ]

Loading…
Cancel
Save