|
@ -48,6 +48,7 @@ import { last } from 'lodash'; |
|
|
}) |
|
|
}) |
|
|
export class InvestmentChartComponent implements OnChanges, OnDestroy { |
|
|
export class InvestmentChartComponent implements OnChanges, OnDestroy { |
|
|
@Input() benchmarkDataItems: InvestmentItem[] = []; |
|
|
@Input() benchmarkDataItems: InvestmentItem[] = []; |
|
|
|
|
|
@Input() benchmarkDataLabel = ''; |
|
|
@Input() colorScheme: ColorScheme; |
|
|
@Input() colorScheme: ColorScheme; |
|
|
@Input() currency: string; |
|
|
@Input() currency: string; |
|
|
@Input() daysInMarket: number; |
|
|
@Input() daysInMarket: number; |
|
@ -153,7 +154,7 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy { |
|
|
y: this.isInPercent ? investment * 100 : investment |
|
|
y: this.isInPercent ? investment * 100 : investment |
|
|
}; |
|
|
}; |
|
|
}), |
|
|
}), |
|
|
label: $localize`Deposit`, |
|
|
label: this.benchmarkDataLabel, |
|
|
segment: { |
|
|
segment: { |
|
|
borderColor: (context: unknown) => |
|
|
borderColor: (context: unknown) => |
|
|
this.isInFuture( |
|
|
this.isInFuture( |
|
@ -194,6 +195,9 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy { |
|
|
this.chart.options.plugins.tooltip = <unknown>( |
|
|
this.chart.options.plugins.tooltip = <unknown>( |
|
|
this.getTooltipPluginConfiguration() |
|
|
this.getTooltipPluginConfiguration() |
|
|
); |
|
|
); |
|
|
|
|
|
this.chart.options.scales.x.min = this.daysInMarket |
|
|
|
|
|
? subDays(new Date(), this.daysInMarket).toISOString() |
|
|
|
|
|
: undefined; |
|
|
this.chart.update(); |
|
|
this.chart.update(); |
|
|
} else { |
|
|
} else { |
|
|
this.chart = new Chart(this.chartCanvas.nativeElement, { |
|
|
this.chart = new Chart(this.chartCanvas.nativeElement, { |
|
@ -264,6 +268,10 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy { |
|
|
color: `rgba(${getTextColor(this.colorScheme)}, 0.8)`, |
|
|
color: `rgba(${getTextColor(this.colorScheme)}, 0.8)`, |
|
|
display: false |
|
|
display: false |
|
|
}, |
|
|
}, |
|
|
|
|
|
min: this.daysInMarket |
|
|
|
|
|
? subDays(new Date(), this.daysInMarket).toISOString() |
|
|
|
|
|
: undefined, |
|
|
|
|
|
suggestedMax: new Date().toISOString(), |
|
|
type: 'time', |
|
|
type: 'time', |
|
|
time: { |
|
|
time: { |
|
|
tooltipFormat: getDateFormatString(this.locale), |
|
|
tooltipFormat: getDateFormatString(this.locale), |
|
|