Forum Academy Marketplace Showcase Pricing Features

Chart JS and Plugin Editor

I would like create a personalised element for my plugin in the Plugin Editor which simply display a simple Chart from the Char.JS library.

For now I did this :

But i had no luck, is there something I am missing ?

Thanks in advance

On line 46, does the “div” variable really exist? Maybe it was supposed to be “ctx”.

2 Likes

What issues are you experiencing?

I also see that you call a method on div but div is never defined by an element on the DOM.

Sorry that was my mistake i did not need to define any onClick function on div, i removed it now but still not luck, cannot see the ctx (new Chart) do you know how I can display it ?

This is my code right now but still nothing :

Figured it out !!! :clap: :
I had first append the div (ctx) to the instance.canvas and then do :

const myChart = new Chart(
    document.getElementById('myChart'),
    config
  );

like this :