Browse Source

fix(client): type safety on annotations

pull/6277/head
Kenrick Tandrian 6 days ago
parent
commit
686f2763d6
  1. 16
      apps/client/src/app/components/investment-chart/investment-chart.component.ts

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

@ -41,7 +41,9 @@ import {
type TooltipOptions
} from 'chart.js';
import 'chartjs-adapter-date-fns';
import annotationPlugin from 'chartjs-plugin-annotation';
import annotationPlugin, {
type AnnotationOptions
} from 'chartjs-plugin-annotation';
import { isAfter } from 'date-fns';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
@ -162,14 +164,10 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy {
this.chart.options.plugins.tooltip =
this.getTooltipPluginConfiguration();
if (
this.savingsRate &&
// @ts-ignore
this.chart.options.plugins.annotation.annotations.savingsRate
) {
// @ts-ignore
this.chart.options.plugins.annotation.annotations.savingsRate.value =
this.savingsRate;
const annotations = this.chart.options.plugins.annotation
.annotations as Record<string, AnnotationOptions<'line'>>;
if (this.savingsRate && annotations.savingsRate) {
annotations.savingsRate.value = this.savingsRate;
}
this.chart.update();

Loading…
Cancel
Save