Browse Source

update unit in graph caption

pull/5570/head
Batwam 1 month ago
parent
commit
c4603140da
No known key found for this signature in database GPG Key ID: 7D9EDF6264938D38
  1. 17
      apps/client/src/app/components/home-overview/home-overview.component.ts
  2. 2
      apps/client/src/app/components/home-overview/home-overview.html

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

@ -61,7 +61,8 @@ export class GfHomeOverviewComponent implements OnDestroy, OnInit {
public showDetails = false;
public unit: string;
public user: User;
private choice: string = 'netPerformanceInPercentageWithCurrencyEffect';
private graph_type: string = 'netPerformanceInPercentageWithCurrencyEffect';
public graph_unit: string;
private unsubscribeSubject = new Subject<void>();
@ -132,15 +133,19 @@ export class GfHomeOverviewComponent implements OnDestroy, OnInit {
this.errors = errors;
this.performance = performance;
const multiplier =
this.choice === 'netPerformanceInPercentageWithCurrencyEffect'
const graph_multiplier =
this.graph_type === 'netPerformanceInPercentageWithCurrencyEffect'
? 100
: 1;
this.graph_unit =
this.graph_type === 'netPerformanceInPercentageWithCurrencyEffect'
? '%'
: this.unit;
this.historicalDataItems = chart.map((item) => {
return {
date: item.date,
value: item[this.choice] * multiplier
value: item[this.graph_type] * graph_multiplier
};
});
@ -160,8 +165,8 @@ export class GfHomeOverviewComponent implements OnDestroy, OnInit {
this.changeDetectorRef.markForCheck();
}
public onMetricClick(selectedChoice: string): void {
this.choice = selectedChoice; // update metric choice
public onMetricClick(selectedgraph_type: string): void {
this.graph_type = selectedgraph_type; // update metric graph_type
this.update(); // rebuild historicalDataItems
}
}

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

@ -69,7 +69,6 @@
<div class="chart-container mx-auto position-relative">
<gf-line-chart
class="position-absolute"
unit="%"
[colorScheme]="user?.settings?.colorScheme"
[hidden]="historicalDataItems?.length === 0"
[historicalDataItems]="historicalDataItems"
@ -81,6 +80,7 @@
[showLoader]="false"
[showXAxis]="false"
[showYAxis]="false"
[unit]="graph_unit"
/>
</div>
</div>

Loading…
Cancel
Save