Amchart 5

Hello, I am working with amchart 5 and want to use
let maybeDisposeRoot = (divId) => {
am5.array.each(am5.registry.rootElements, function (root) {
if (root.dom.id == divId) {
root.dispose();
}
});
};

  maybeDisposeRoot(divId);

It doesn’t work for more than one graph and I want to use it for more than 1 haha
if someone can help me thank you

Have you an example notebook?

1 Like

https://codepen.io/team/amcharts/embed/GROEEXP?default-tab=result&editable=true&theme-id=dark
This is how it works for a graph but since I have more than one graph
this is the error when running it
Uncaught TypeError: Cannot read properties of undefined (reading ‘dom’)

This is a forum for discussing Observable - a notebook environment for using Javascript to explore data visualization. Thus, I suspect that @hellonearthis wondered if you have a working example of an Observable notebook. Also, some libraries are used much more frequently here than others - D3 and Plot are certainly the most widely used here with certainly thousands of examples. As far as I can tell, though, there’s just one notebook using amcharts, namely:

So this is probably not the right place to ask questions about amcharts. If you do find yourself using D3, Plot, or other libraries on Observable, though, then this is the perfect place to ask!

2 Likes