I used versions 5.0.0-beat and 4.0.0 respectively, it works but I am getting the following compilation error from webpackserver:
error TS2322: Type '{ legend: { display: false; }; title: { display: true; text: string; }; labels: { fontColor: string; fontStyle: string; fontSize: number; position: string; }; }' is not assignable to type '_DeepPartialObject<PluginOptionsByType<"pie">>'.
Object literal may only specify known properties, and 'labels' does not exist in type '_DeepPartialObject<PluginOptionsByType<"pie">>'.
import {ActiveElement,/ Chart, /ChartEvent, registerables} from 'chart.js';
import {ClosedAlertsGraphData, OpenAlertsGraphData} from './open-alerts-graph-data.model';
import {Router} from '@angular/router';
import {OpenAlertsGraphService} from "./open-alerts-graph.service";
import {GraphTypes, OpenAlerts} from '../../../main/open-alerts/open-alerts.model';
import Chart from 'chart.js/auto';
import { getChartLabelPlugin, PLUGIN_ID} from 'chart.js-plugin-labels-dv';
My versions are:
"chart.js": "^4.1.1",
"chart.js-plugin-labels-dv": "^4.0.0",
Same also happens with 5.0.0-beta
Angular version is: 'ng-version="12.2.16"'
I used versions 5.0.0-beat and 4.0.0 respectively, it works but I am getting the following compilation error from webpackserver: error TS2322: Type '{ legend: { display: false; }; title: { display: true; text: string; }; labels: { fontColor: string; fontStyle: string; fontSize: number; position: string; }; }' is not assignable to type '_DeepPartialObject<PluginOptionsByType<"pie">>'. Object literal may only specify known properties, and 'labels' does not exist in type '_DeepPartialObject<PluginOptionsByType<"pie">>'.
labels: { fontColor: '#000', position: 'border', }
Any ideas?
Here is my code:
import {ActiveElement,/ Chart, /ChartEvent, registerables} from 'chart.js'; import {ClosedAlertsGraphData, OpenAlertsGraphData} from './open-alerts-graph-data.model'; import {Router} from '@angular/router'; import {OpenAlertsGraphService} from "./open-alerts-graph.service"; import {GraphTypes, OpenAlerts} from '../../../main/open-alerts/open-alerts.model'; import Chart from 'chart.js/auto'; import { getChartLabelPlugin, PLUGIN_ID} from 'chart.js-plugin-labels-dv';
const canvasElmnt = this.elementRef.nativeElement.querySelector('canvas[name="openAlertsCanvas"]'); Chart.register(getChartLabelPlugin()); const router = this.router; const closedAlertsData = data; const product = this.product; Chart.defaults.font.size = 12; console.log("them 1: " + Chart.registry?.plugins.get(PLUGIN_ID));