|
|
|
@ -7,11 +7,7 @@ import { |
|
|
|
getZeroLineAnnotation, |
|
|
|
transformTickToAbbreviation |
|
|
|
} from '@ghostfolio/common/chart-helper'; |
|
|
|
import { |
|
|
|
DEFAULT_COLOR_SCHEME, |
|
|
|
primaryColorRgb, |
|
|
|
secondaryColorRgb |
|
|
|
} from '@ghostfolio/common/config'; |
|
|
|
import { primaryColorRgb, secondaryColorRgb } from '@ghostfolio/common/config'; |
|
|
|
import { getLocale, parseDate } from '@ghostfolio/common/helper'; |
|
|
|
import { LineChartItem } from '@ghostfolio/common/interfaces'; |
|
|
|
import { InvestmentItem } from '@ghostfolio/common/interfaces/investment-item.interface'; |
|
|
|
@ -174,15 +170,13 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy { |
|
|
|
|
|
|
|
this.chart.update(); |
|
|
|
} else { |
|
|
|
const colorScheme = this.colorScheme ?? DEFAULT_COLOR_SCHEME; |
|
|
|
|
|
|
|
this.chart = new Chart<'bar' | 'line'>( |
|
|
|
this.chartCanvas().nativeElement, |
|
|
|
{ |
|
|
|
data: chartData, |
|
|
|
options: { |
|
|
|
animation: false, |
|
|
|
elements: getChartElementsOptions(colorScheme), |
|
|
|
elements: getChartElementsOptions(this.colorScheme), |
|
|
|
interaction: { intersect: false, mode: 'index' }, |
|
|
|
maintainAspectRatio: true, |
|
|
|
plugins: { |
|
|
|
@ -210,7 +204,7 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy { |
|
|
|
value: this.savingsRate |
|
|
|
} |
|
|
|
: undefined, |
|
|
|
yAxis: getZeroLineAnnotation(colorScheme) |
|
|
|
yAxis: getZeroLineAnnotation(this.colorScheme) |
|
|
|
} |
|
|
|
}, |
|
|
|
legend: { |
|
|
|
@ -218,18 +212,18 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy { |
|
|
|
}, |
|
|
|
tooltip: this.getTooltipPluginConfiguration(), |
|
|
|
verticalHoverLine: { |
|
|
|
color: getChartBorderColor(colorScheme) |
|
|
|
color: getChartBorderColor(this.colorScheme) |
|
|
|
} |
|
|
|
}, |
|
|
|
responsive: true, |
|
|
|
scales: { |
|
|
|
x: getTimeAxisOptions({ |
|
|
|
colorScheme, |
|
|
|
borderWidth: this.groupBy ? 0 : 1, |
|
|
|
colorScheme: this.colorScheme, |
|
|
|
locale: this.locale |
|
|
|
}), |
|
|
|
y: getValueAxisOptions({ |
|
|
|
colorScheme, |
|
|
|
colorScheme: this.colorScheme, |
|
|
|
display: !this.isInPercentage, |
|
|
|
tickCallback: (tickValue) => { |
|
|
|
return transformTickToAbbreviation(Number(tickValue)); |
|
|
|
@ -238,7 +232,7 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy { |
|
|
|
} |
|
|
|
}, |
|
|
|
plugins: [ |
|
|
|
getVerticalHoverLinePlugin(this.chartCanvas(), colorScheme) |
|
|
|
getVerticalHoverLinePlugin(this.chartCanvas(), this.colorScheme) |
|
|
|
], |
|
|
|
type: this.groupBy ? 'bar' : 'line' |
|
|
|
} |
|
|
|
@ -251,7 +245,7 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy { |
|
|
|
TooltipOptions<'bar' | 'line'> |
|
|
|
> { |
|
|
|
return getTimeSeriesTooltipOptions<'bar' | 'line'>({ |
|
|
|
colorScheme: this.colorScheme ?? DEFAULT_COLOR_SCHEME, |
|
|
|
colorScheme: this.colorScheme, |
|
|
|
currency: this.isInPercentage ? undefined : this.currency, |
|
|
|
groupBy: this.groupBy, |
|
|
|
locale: this.isInPercentage ? undefined : this.locale, |
|
|
|
|