plainheart commented on issue #14714:
URL: https://github.com/apache/echarts/issues/14714#issuecomment-822949906


   
   
   > it get the same value finally, and there is a flaw in the demo, **space** 
remain after filling bgImg (Please see below).
   
   But I got the expected result. Are there some special steps I need to notice?
   
   
https://user-images.githubusercontent.com/26999792/115333899-0342a900-a1cd-11eb-8e2d-c7b8b9ae37c7.mp4
   
   
   Besides, I run the code based on your demo, it's also working now.
   ```js
   var image = new Image();
   image.src = 
'https://ss2.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/zhidao/pic/item/5d6034a85edf8db18e821f720a23dd54564e7473.jpg'
   image.onload = function() {
       var rect = myChart._api.getCoordinateSystems()[0].getRect();
       image.width = rect.width;
       image.height = rect.height;
       myChart.setOption({
           graphic: [{
               id: 'bg',
               type: 'image',
               style: {
                   image: image,
                   x: rect.x,
                   y: rect.y
               }
           }]
       });
       // TODO listen to resize, update the width/height/x/y of image according 
to the grid rect
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to