Closed ghost closed 1 year ago
@kurkle go to version 3 or 2.2.2?
Hi @stockiNail ,
I tried version 3.0.0 and I have a new error :
Object literal may only specify known properties, and 'annotation' does not exist in type '_DeepPartialObject<PluginOptionsByType<keyof ChartTypeRegistry, keyof ChartTypeRegistry>>'.
With this code :
import { Chart } from "chart.js/auto";
import * as moment from 'moment';
import zoomPlugin from 'chartjs-plugin-zoom';
import annotationPlugin from 'chartjs-plugin-annotation';
import 'chartjs-adapter-moment';
Chart.register(annotationPlugin)
...
new Chart(chartRef.nativeElement, {
type: 'bar',
plugins: [zoomPlugin],
data: {
datasets: datasets
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
zoom: {
zoom: {
drag: {
enabled: true
},
mode: 'x',
},
},
annotation: { } // If I comment this line, error disappears. If I put content inside this object to draw my annotations, still have the error
}
},
})
My versions : "chart.js": "^4.3.0", "chartjs-adapter-moment": "^1.0.1", "chartjs-plugin-annotation": "^3.0.0", "chartjs-plugin-zoom": "^2.0.1",
If I remove zoom plugin, it works though. But I would like both plugins. Any suggestion ?
@rfrancois created an issue: https://github.com/chartjs/chartjs-plugin-annotation/issues/886 I had a quick look and I was able to reproduce it. Also here, it doesn't depend on annotation plugin but unfortunately there is, in my opinion, something not well defined (at types level) in Chart.js. I say that because in my test case, I have the issue on zoom instead of annotation (depends on import order).
Closes #854