plainheart edited a comment on issue #12539:
URL: 
https://github.com/apache/incubator-echarts/issues/12539#issuecomment-623239002


   @yycyeung My pleasure.
   
   **Fixing code**
   ```js
   LeafletCoordSys.prototype.prepareCustoms = function (data) {
     var rect = this.getViewRect();
     return {
         coordSys: {
             type: 'leaflet',
             x: rect.x,
             y: rect.y,
             width: rect.width,
             height: rect.height
         },
         api: {
             coord: echarts.util.bind(this.dataToPoint, this),
             size: echarts.util.bind(dataToCoordSize, this)
         }
     };
   };
   
   function dataToCoordSize(dataSize, dataItem) {
       dataItem = dataItem || [0, 0];
       return echarts.util.map([0, 1], function (dimIdx) {
           var val = dataItem[dimIdx];
           var halfSize = dataSize[dimIdx] / 2;
           var p1 = [];
           var p2 = [];
           p1[dimIdx] = val - halfSize;
           p2[dimIdx] = val + halfSize;
           p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];
           return Math.abs(this.dataToPoint(p1)[dimIdx] - 
this.dataToPoint(p2)[dimIdx]);
       }, this);
   }
   ```
   
   - Add codes above to the dist file `echarts-leaflet.js` after [line 
87](https://github.com/gnijuohz/echarts-leaflet/blob/master/dist/echarts-leaflet.js#L87)
 or modify the source file `LeafletCoordSys.js` and rebuild it.
   
   - Rerun your project and we can see the expected result. (Maybe need to 
rebuild if you are using esModule)
   
   
![image](https://user-images.githubusercontent.com/26999792/80934022-c1242a00-8df8-11ea-8489-354eff6997cd.png)
   
   


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