caoxiemeihao opened a new issue #14069:
URL: https://github.com/apache/echarts/issues/14069


   ### Version
   5.0.1
   
   ### Steps to reproduce
   1. 先绘制中国地图
   2. 点击某个省之后,重新注册对应省的地图数据并再次调用 setOption
   
   ### What is expected?
   能像 4.x 版本一样向下钻取地图时候有过渡动画效果
   
   ### What is actually happening?
   没有过渡动画效果
   
   ---
   
   ```typescript
   const myCharts = init(document.getElementById(id) as HTMLDivElement);
       let currentGeoJson: GeoJsonCity = GeoChina as any; // 当前绘制数据
   
       // 监听点击事件
       myCharts.on('click', params => {
         const ev = params as EchartEvent
         const item = currentGeoJson.features.find(geo => geo.properties.name 
=== ev.name)
         get_geoJSON_byCode(item?.properties.adcode as string, {
           listen(load) { load ? myCharts.showLoading() : 
myCharts.hideLoading() }
         }).then(geoJson => {
           currentGeoJson = geoJson;
           const { properties } = geoJson.features[0]
           drawMap({
             charts: myCharts,
             name: `${properties.name}-${properties.adcode}`,
             geoJson,
           });
         })
       });
   
       // 绘制地图函数
       function drawMap({
         charts,
         name = '中国',
         geoJson = GeoChina as any,
       }: {
         charts: ECharts;
         name?: string;
         geoJson?: GeoJsonProvice | GeoJsonCity;
       }) {
         if (!getMap(name)) {
           // 向 echarts 注入地图数据;name 为 series 中使用时候的标识
           registerMap(name, geoJson as any);
         }
   
         // 绘制地图
         charts.setOption({
           geo: {
             map: name,
             zoom: 1.1999,
             animation: true,
             animationDuration: 1999,
           },
         });
   
         return charts;
       }
   
       drawMap({ charts: myCharts });
   
     /**
      * 根据 adcode 获取 geo 数据;localhost 会被反爬 - 用 proxy 或者改 host
      * @param code adcode
      */
     export async function get_geoJSON_byCode(
       code: string | number,
       { full = true, listen = (bool: boolean) => { } } = {},
     ): Promise<GeoJsonCity> {
       listen(true);
       const res = await fetch(proxy(`/areas/bound/geojson?code=${code   (full 
? '_full' : '')}`))
       listen(false);
       return res.json()
     }
   ```
   
   <!-- 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:
[email protected]



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

Reply via email to