Skip to content

Server Error when using annotation plugin with Chart.js 4.0.1 in NextJS app #814

@ferremekelenkamp

Description

@ferremekelenkamp

Hey guys,

First of all, thanks for making this super helpful library!

I am currently working on a NextJS and have implemented ChartJS v4.0.1. All works well, but when I want to install the annotation plugin and follow the steps of https://www.chartjs.org/chartjs-plugin-annotation/latest/guide/integration.html I get the following error:
Schermafbeelding 2022-12-01 om 11 25 58

My React component is: (only relevant is shown)

import {useEffect, useState} from "react";
import {BarElement, CategoryScale, Chart as ChartJS, Legend, LinearScale, Title, Tooltip} from 'chart.js';
import Annotation from 'chartjs-plugin-annotation';
import {Bar} from 'react-chartjs-2';

ChartJS.register(
    CategoryScale,
    LinearScale,
    BarElement,
    Title,
    Tooltip,
    Legend,
    Annotation,
);

.........

Do you guys have any idea how to solve this? Is it an issue because of ChartJS v4?

Thanks a lot!

Cheers,
Ferre

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions