eapatel edited a comment on issue #15256:
URL: https://github.com/apache/echarts/issues/15256#issuecomment-871060690


   @plainheart I added .esm file to my project. I'm getting below errors in 
console 
   **this.echartsInstance is undefined 
   this.echartsInstance.getModel() is undefined**
   
   Here is my ts code
   -----------------------------------------
   import { EChartOption } from 'echarts';
   import L from 'leaflet';
   import '../../dist/echarts-extension-leaflet.esm.js';
   
   echartsInstance: any;
   option: EChartOption = {};
   
   ngAfterViewInit(): void {
       this.setOptions();
   }
   
   setOptions() {
       this.option = {
         leaflet: {
           roam: true,
           center: [4.9,-1.766667],
           zoom: 2,
           renderOnMoving: true,
           largeMode: false,
         },
         series: [
              this.getData()
          ]
       };
     }
   
   initMap() {
       var map = 
this.echartsInstance.getModel().getComponent("leaflet").getMap();
       var southWest = L.latLng(-89.98155760646617, -180),
       northEast = L.latLng(89.99346179538875, 180);
       var bounds = L.latLngBounds(southWest, northEast);
       map.setMaxBounds(bounds);
   
           L.tileLayer('assets/tiles/{z}/{x}/{y}.jpg', {
               minZoom: 2,
               MaxZoom: 6,
               attribution: ''
             }).addTo(map);
       }
     
     onChartInit(echarts: any) {
         this.echartsInstance = echarts;
         this.setOptions();  
         this.initMap();
         this.resizeChart();
     }
   
   resizeChart() {
       if (this.echartsInstance) {
         this.echartsInstance.resize();
       }
     }
   
   And here is my template code
   -----------------------------------------
   
       <div echarts
           [options]="option"
           (chartInit)="onChartInit($event)">
       </div>
   
   Can you please help me to figure out why it says instance is undefined? 


-- 
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.

To unsubscribe, e-mail: [email protected]

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