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 2018/11/05 04:10:54 UTC

[GitHub] DorisOu opened a new issue #9335: 建议还是用自定义系列的 polygon 绘制

DorisOu opened a new issue #9335: 建议还是用自定义系列的 polygon 绘制
URL: https://github.com/apache/incubator-echarts/issues/9335
 
 
   当自定义区域的坐标为这样的格式 var paths = [
           [
               [113.447976, 22.363792],
               [113.328872, 22.422652],
               [113.370276, 22.308298],
               [113.474307, 22.260588]
           ],
           [
               [113.55542316292018, 22.451920414231754],
               [113.55552840279444, 22.452818734758235],
               [113.55371761986818, 22.453423869526087],
               [113.55356109301499, 22.454512840320145]
           ]
       ]
   
   renderItem这样写起效果了。但是无法渲染第二数组
   function renderItem(params, api) {
           var coords = paths[0];
           var points = [];
           for (var i = 0; i < coords.length; i++) {
               points.push(api.coord(coords[i]));
           }
           return {
               type: 'polygon',
               shape: {
                   points: echarts.graphic.clipPointsByRect(points, {
                       x: params.coordSys.x,
                       y: params.coordSys.y,
                       width: params.coordSys.width,
                       height: params.coordSys.height
                   })
               },
               style: api.style({
                   fill: 'lightblue',
                   stroke: '#000'
               })
           }
       }
   如何写出复用的函数?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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