You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2022/01/13 05:20:38 UTC

[echarts] branch enhance-map updated: test(map): update projection test case

This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch enhance-map
in repository https://gitbox.apache.org/repos/asf/echarts.git


The following commit(s) were added to refs/heads/enhance-map by this push:
     new 1f2ea20  test(map): update projection test case
1f2ea20 is described below

commit 1f2ea20e23e53812ee0df8f92f54b5b4c213e000
Author: pissang <bm...@gmail.com>
AuthorDate: Thu Jan 13 13:19:46 2022 +0800

    test(map): update projection test case
---
 test/map-projection.html | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/test/map-projection.html b/test/map-projection.html
index afe2752..06fe697 100644
--- a/test/map-projection.html
+++ b/test/map-projection.html
@@ -52,7 +52,6 @@ under the License.
             ], function (echarts, chinaJson) {
                 echarts.registerMap('china', chinaJson)
 
-                const projection = d3.geoMercator()
                 option = {
                     series: {
                         type: 'map',
@@ -62,10 +61,8 @@ under the License.
                             borderColor: '#000'
                         },
                         projection: {
-                            project: (pt) => {
-                                return projection(pt)
-                            },
-                            unproject: (pt) => projection.invert(pt)
+                            project: (point) => [point[0] / 180 * Math.PI, -Math.log(Math.tan((Math.PI / 2 + point[1] / 180 * Math.PI) / 2))],
+                            unproject: (point) => [point[0] * 180 / Math.PI, 2 * 180 / Math.PI * Math.atan(Math.exp(point[1])) - 90]
                         }
                     }
                 };

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