Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

249
Vistas
Cannot find file: 'Chart.js' does not match the corresponding name on disk: '.\node_modules\chart.js\dist\chart.js'

i am trying to impliment a bar chart what am i doing wrong here?

here also i am getting error saying to use typescript

formatter: (value: number) => value + " %", but i use only .js format

import { Chart } from "chart.js";

import { Bar } from "react-chartjs-2";
import ChartjsPluginStacked100 from "chartjs-plugin-stacked100";
import "chart.js/auto";
import ChartDataLabels from "chartjs-plugin-datalabels";
Chart.register(ChartDataLabels);

const ExampleChart = () => (
  <Bar
    data={{
      labels: ["January", "February", "March", "April", "May", "June", "July"],
      datasets: [
        {
          label: "My First dataset",
          backgroundColor: "#EC932F",
          borderColor: "rgba(255,99,132,1)",
          borderWidth: 1,
          hoverBackgroundColor: "rgba(255,99,132,0.4)",
          hoverBorderColor: "rgba(255,99,132,1)",
          data: [65, 59, 80, 81, 56, 55, 100],
          borderRadius: 50, // Make Rectangle rounded
        },
      ],
    }}
    options={{
      indexAxis: "y", // Horizontal bar
      plugins: {
        datalabels: {
          formatter: (value: number) => value + " %", // Add the percentage after the value
          align: "end",
          anchor: "end",
          clip: true, // Hide label if outside of the chart
        },
      },
      scales: {
        x: {
          grid: {
            display: false, // Hide x grid
          },
        },
        y: {
          grid: {
            display: false, // Hide y grid
          },
        },
      },
    }}
  />
);

export default function bar() {
  return (
    <div className="">
      <ExampleChart />
    </div>
  );
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Seems like you are using typings in .js file.

Remove Typings from your formatter function

 formatter: (value) => value + " %", // Add the percentage after the value

Working StackBlitz

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda