This error is because you are using two charts in the same container

in my case I solve this error by adding :
dispose()
serves to first delete all contents of the <div> container
Example:

am5.ready(function() {
am5.array.each(am5.registry.rootElements, function(root) {
if (root.dom.id == 'chartdiv') {
root.dispose();
}
});
});
for more Information about AmchartJS
for more on this error