Friday, 15 October 2021

Canvas not showing even though the code is there

I am trying to show a Gauge on my Magic Mirror Dashboard in my module programmatically.

The below is a sample of my code:

    var indoorGauge = document.createElement('canvas');
    indoorGauge.id = 'indoorGauge';
    ...
    indoorGauge.setAttribute('data-animation-target','plate');  
    indoorPressure.appendChild(indoorGauge);        
    insideTele.appendChild(indoorPressure);
    wrapper.appendChild(insideTele);

The gauge doesn't show or render. What I'm finding odd is that when I inspect element, the canvas is all there and it works, because when I cut out the element and re-paste it, it will show up and work perfectly!

enter image description here

If I 'cut' and 'paste' the above canvas element, the gauge will show just fine.

enter image description here



from Canvas not showing even though the code is there

No comments:

Post a Comment