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

332
Vistas
In chart.js, how do I invoke a plugin on completing the first render?

I have this plugin for chart.js that renders gradient fills for a stacked bar chart on afterRender. The gradient fills all become visible if i resize the browser window, or call chart.update() in an onClick function. The background gradient becomes visible when I hover on each individual element of the bar chart.

Calling chart.update() within that plugin forces all gradients to draw on the first render of the stacked bar chart, but seems to trigger a runaway effect where the updating of the chart triggers a re-render and that doesn't seem good.

So I'm a little puzzled on what's going wrong here. Calling chart.update() in a React hook doesn't have the expected effect for me. How do I make sure that this plugin runs and completes before the first draw? Or is there perhaps something more fundamentally wrong with this?

I am using react-chartjs-2.

Code sample: https://codesandbox.io/s/blissful-monad-vq1fn?file=/App.tsx

Appreciate any input on this

about 4 years ago · Juan Pablo Isaza
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