Skip to content

Commit

Permalink
chore: change checker
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaZhem committed Aug 29, 2024
1 parent 6f289b2 commit 4da20fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[horizontalLines]="4"
[verticalLines]="4"
>
@if (checkInfinity(maxPrice()) && checkInfinity(minPrice())) {
@if (history()) {
<tui-line-chart
class="chart"
[height]="maxPrice() * (maxPrice() > 10 ? 1 : 100) - minPrice() * (maxPrice() > 10 ? 1 : 100)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ export class PriceChartComponent {

protected chart = computed(() => this.processData(this.history()));

protected minPrice = computed(
() => Math.min(...(this.history() ?? []).map((val) => Number(val.priceUsd))) || 0,
protected minPrice = computed(() =>
Math.min(...(this.history() ?? []).map((val) => Number(val.priceUsd))),
);

protected maxPrice = computed(
() => Math.max(...(this.history() ?? []).map((val) => Number(val.priceUsd))) || 0,
protected maxPrice = computed(() =>
Math.max(...(this.history() ?? []).map((val) => Number(val.priceUsd))),
);

protected filterButtons = ['D', 'W', 'M', 'M6', 'Y'];
Expand All @@ -94,10 +94,6 @@ export class PriceChartComponent {
return fullSize.filter((_, i) => i % this.step() === 0);
}

protected checkInfinity(value: number): boolean {
return Number.isFinite(value);
}

protected readonly yStringify: TuiStringHandler<number> = (y) =>
`${(this.maxPrice() > 10 ? y : y / 100).toLocaleString('en-US', {maximumFractionDigits: this.maxPrice() > 10 ? 0 : 2})} $`;

Expand Down

0 comments on commit 4da20fb

Please sign in to comment.