Browse Source

fix(ui): improve type safety of line chart data

pull/8050/head
KenTandrian 2 weeks ago
parent
commit
b473c0f2e7
  1. 5
      libs/ui/src/lib/line-chart/line-chart.component.ts

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

@ -27,6 +27,7 @@ import {
import { import {
type AnimationsSpec, type AnimationsSpec,
Chart, Chart,
type ChartData,
Filler, Filler,
LinearScale, LinearScale,
LineController, LineController,
@ -167,7 +168,7 @@ export class GfLineChartComponent
gradient.addColorStop(1, getBackgroundColor(this.colorScheme)); gradient.addColorStop(1, getBackgroundColor(this.colorScheme));
} }
const data = { const data: ChartData<'line', (number | null)[]> = {
labels, labels,
datasets: [ datasets: [
{ {
@ -208,7 +209,7 @@ export class GfLineChartComponent
this.chart.update(); this.chart.update();
} else { } else {
this.chart = new Chart(this.chartCanvas.nativeElement, { this.chart = new Chart<'line'>(this.chartCanvas.nativeElement, {
data, data,
options: { options: {
animations: this.isAnimated ? animations : undefined, animations: this.isAnimated ? animations : undefined,

Loading…
Cancel
Save