Unable to load echart on dynamically created element

33 Views Asked by At

We are facing a blank chart while initializing echart on a dynamically created element.

We had tried using the below snippet.

let chartDom = document.createElement("div");
chartDom.style.height = "350px";
var myChart = echarts.init(chartDom, null, {
    renderer: 'canvas',
});
1

There are 1 best solutions below

0
Matthias Mertens On

From the documentation:

dom - Instance container, usually is a DIV element with height and width defined.

So I would suggest defining the width of the div element.