You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2019/06/13 07:19:33 UTC

[GitHub] [incubator-echarts] chfw opened a new issue #10667: Hard coded center point for Russia and United States

chfw opened a new issue #10667: Hard coded center point for Russia and United States
URL: https://github.com/apache/incubator-echarts/issues/10667
 
 
   ### Version
   4.2.1
   
   ### Steps to reproduce
   https://echarts-maps.github.io/echarts-geomapping-book-zh/intermediate/change-world-center/
   
   In short: world.json is re-projected using eckert3 and rotated -150 degrees, then country names 'Russia' and 'United States' appears in the "sky".
   
   And you can view it here and scroll all the way to the bottom, look at eckert3-world.js: 
   
   https://echarts-maps.github.io/echarts-countries-js/preview.html
   
   <img width="617" alt="Screenshot 2019-06-13 at 08 13 57" src="https://user-images.githubusercontent.com/4280312/59411456-3509ae00-8db3-11e9-970a-bffd6c2a1be3.png">
   
   
   ### What is expected?
   Country names, 'Russia' and 'United States' will appear on top of their country region.
   
   <img width="609" alt="Screenshot 2019-06-13 at 08 16 02" src="https://user-images.githubusercontent.com/4280312/59411616-929dfa80-8db3-11e9-961e-533fd1cdc0a3.png">
   <img width="311" alt="Screenshot 2019-06-13 at 08 16 11" src="https://user-images.githubusercontent.com/4280312/59411660-a9445180-8db3-11e9-86e9-78a5733e9542.png">
   
   
   ### What is actually happening?
   Both names appears on the top left corner.
   
   <img width="505" alt="Screenshot 2019-06-13 at 08 10 49" src="https://user-images.githubusercontent.com/4280312/59411298-d3e1da80-8db2-11e9-95c2-b312a39a396a.png">
   
   <img width="612" alt="Screenshot 2019-06-13 at 08 10 57" src="https://user-images.githubusercontent.com/4280312/59411310-da705200-8db2-11e9-954f-13263eddecbe.png">
   
   ---
   This is caused by https://github.com/apache/incubator-echarts/blob/master/src/coord/geo/fix/geoCoord.js.
   
   ```
   var geoCoordMap = {
       'Russia': [100, 60],
       'United States': [-99, 38],
       'United States of America': [-99, 38]
   };
   
   export default function (mapType, region) {
       if (mapType === 'world') {
           var geoCoord = geoCoordMap[region.name];
           if (geoCoord) {
               var cp = region.center;
               cp[0] = geoCoord[0];
               cp[1] = geoCoord[1];
           }
       }
   }
   ```
   
   Of course, the workaround is to change the country names to something else for now, but hard coded fixes shall NEVER be there in CODE.
   
   Related to: https://github.com/apache/incubator-echarts/issues/3899
   
   
   
   <!-- This issue is generated by echarts-issue-helper. DO NOT REMOVE -->
   <!-- This issue is in English. DO NOT REMOVE -->

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org