You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/07/11 05:33:24 UTC

[GitHub] [echarts] tangdaohai commented on issue #9455: 关于geo中roam的交互

tangdaohai commented on issue #9455:
URL: https://github.com/apache/echarts/issues/9455#issuecomment-1179984839

   发现了同样的问题。不过可以通过需要放到区域和整个地图的坐标宽高比例来设置 zoom 属性进行放大。
   
   `_api.getModel()?.getSeriesByIndex(0).coordinateSystem` 这个 API 属性中可以拿到 `_rect` 属性信息:
   
   ```
   // _chinaMapRect 为整个地图的 rect 信息
   // regionInfo._rect 是某个省份的,可以在 coordinateSystem.regions 获得
   const widthPer = _chinaMapRect.width / regionInfo._rect.width
   const heightPer = _chinaMapRect.height / regionInfo._rect.height
   
   echarts.setOptions({
         series: [{
             center: regionInfo.center,
             layoutCenter: ['50%', '50%'],
             layoutSize: '100%',
             zoom: Math.min(widthPer, heightPer)
         }]
   })
   ```
   
   这样可以获得理想的交互效果


-- 
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: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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