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

Loading…
Cancel
Save