Browse Source

Refactor line chart components to share common chart configuration

pull/7438/head
Thomas Kaul 1 month ago
parent
commit
1c4a3cc968
  1. 6
      apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts
  2. 6
      apps/client/src/app/components/investment-chart/investment-chart.component.ts
  3. 2
      libs/ui/src/lib/line-chart/line-chart.component.ts

6
apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts

@ -192,8 +192,8 @@ export class GfBenchmarkComparatorComponent implements OnChanges, OnDestroy {
}),
y: getValueAxisOptions({
colorScheme: this.colorScheme(),
tickCallback: (value: number) => {
return `${value.toFixed(2)} %`;
tickCallback: (tickValue) => {
return `${Number(tickValue).toFixed(2)} %`;
}
})
}
@ -208,7 +208,7 @@ export class GfBenchmarkComparatorComponent implements OnChanges, OnDestroy {
}
private getTooltipPluginConfiguration(): Partial<TooltipOptions<'line'>> {
return getTimeSeriesTooltipOptions({
return getTimeSeriesTooltipOptions<'line'>({
colorScheme: this.colorScheme(),
locale: this.locale(),
unit: '%'

6
apps/client/src/app/components/investment-chart/investment-chart.component.ts

@ -225,8 +225,8 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy {
y: getValueAxisOptions({
colorScheme: this.colorScheme,
display: !this.isInPercentage,
tickCallback: (value: number) => {
return transformTickToAbbreviation(value);
tickCallback: (tickValue) => {
return transformTickToAbbreviation(Number(tickValue));
}
})
}
@ -244,7 +244,7 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy {
private getTooltipPluginConfiguration(): Partial<
TooltipOptions<'bar' | 'line'>
> {
return getTimeSeriesTooltipOptions({
return getTimeSeriesTooltipOptions<'bar' | 'line'>({
colorScheme: this.colorScheme,
currency: this.isInPercentage ? undefined : this.currency,
groupBy: this.groupBy,

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

@ -292,7 +292,7 @@ export class GfLineChartComponent
}
private getTooltipPluginConfiguration(): Partial<TooltipOptions<'line'>> {
return getTimeSeriesTooltipOptions({
return getTimeSeriesTooltipOptions<'line'>({
colorScheme: this.colorScheme,
currency: this.currency,
locale: this.locale,

Loading…
Cancel
Save