Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
santam85 committed Nov 15, 2023
1 parent af93508 commit 1354c0b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions libs/ng2-charts/src/lib/base-chart.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
tick,
} from '@angular/core/testing';
import { Component } from '@angular/core';
import { Chart, registerables } from 'chart.js';
import { Chart, ChartData, ChartDataset, registerables } from "chart.js";

@Component({
template:
Expand All @@ -19,8 +19,8 @@ import { Chart, registerables } from 'chart.js';
' (chartHover)="hover()"></canvas>',
})
class TestComponent {
public data?: any;
public datasets?: any[];
public data?: ChartData;
public datasets?: ChartDataset[];
public labels?: string[];
public click = jest.fn();
public hover = jest.fn();
Expand Down
8 changes: 4 additions & 4 deletions libs/ng2-charts/src/lib/base-chart.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
ChartEvent,
ChartType,
DefaultDataPoint,
Plugin,
} from 'chart.js';
Plugin, UpdateMode
} from "chart.js";

import { ThemeService } from './theme.service';
import { Subscription } from 'rxjs';
Expand Down Expand Up @@ -126,9 +126,9 @@ export class BaseChartDirective<
);
}

public update(duration?: any): void {
public update(mode?: UpdateMode): void {
if (this.chart) {
this.zone.runOutsideAngular(() => this.chart?.update(duration));
this.zone.runOutsideAngular(() => this.chart?.update(mode));
}
}

Expand Down
28 changes: 14 additions & 14 deletions libs/ng2-charts/src/lib/get-colors.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
import { baseColors } from './base-colors';
import { Color } from 'chart.js';
import { Color, ScriptableContext } from "chart.js";

export const builtInDefaults = {
plugins: { colors: { enabled: false } },
datasets: {
line: {
backgroundColor: (context: any) =>
backgroundColor: (context: ScriptableContext<'line'>) =>
rgba(generateColor(context.datasetIndex), 0.4),
borderColor: (context: any) =>
borderColor: (context: ScriptableContext<'line'>) =>
rgba(generateColor(context.datasetIndex), 1),
pointBackgroundColor: (context: any) =>
pointBackgroundColor: (context: ScriptableContext<'line'>) =>
rgba(generateColor(context.datasetIndex), 1),
pointBorderColor: '#fff',
},
bar: {
backgroundColor: (context: any) =>
backgroundColor: (context: ScriptableContext<'bar'>) =>
rgba(generateColor(context.datasetIndex), 0.6),
borderColor: (context: any) =>
borderColor: (context: ScriptableContext<'bar'>) =>
rgba(generateColor(context.datasetIndex), 1),
},
get radar(): { [key: string]: ((context: any) => Color) | Color } {
get radar(): { [key: string]: ((context: ScriptableContext<'line'>) => Color) | Color } {
return this.line;
},
doughnut: {
backgroundColor: (context: any) =>
backgroundColor: (context: ScriptableContext<'doughnut'>) =>
rgba(generateColor(context.dataIndex), 0.6),
borderColor: '#fff',
},
get pie(): { [key: string]: ((context: any) => Color) | Color } {
get pie(): { [key: string]: ((context: ScriptableContext<'doughnut'>) => Color) | Color } {
return this.doughnut;
},
polarArea: {
backgroundColor: (context: any) =>
backgroundColor: (context: ScriptableContext<'polarArea'>) =>
rgba(generateColor(context.dataIndex), 0.6),
borderColor: (context: any) => rgba(generateColor(context.dataIndex), 1),
borderColor: (context: ScriptableContext<'polarArea'>) => rgba(generateColor(context.dataIndex), 1),
},
get bubble(): { [key: string]: ((context: any) => Color) | Color } {
get bubble(): { [key: string]: ((context: ScriptableContext<'doughnut'>) => Color) | Color } {
return this.doughnut;
},
get scatter(): { [key: string]: ((context: any) => Color) | Color } {
get scatter(): { [key: string]: ((context: ScriptableContext<'doughnut'>) => Color) | Color } {
return this.doughnut;
},
get area(): { [key: string]: ((context: any) => Color) | Color } {
get area(): { [key: string]: ((context: ScriptableContext<'polarArea'>) => Color) | Color } {
return this.polarArea;
},
},
Expand Down

0 comments on commit 1354c0b

Please sign in to comment.