giserJason opened a new issue #9076: 自定义坐标轴,如何传入地理坐标数据给renderItem函数解析
URL: https://github.com/apache/incubator-echarts/issues/9076
 
 
   <!--
   为了方便我们能够复现和修复 bug,请遵从下面的规范描述您的问题。
   -->
   
   
   ### One-line summary [问题简述]
   
在做自定义坐标轴时,遇到一个问题,我想通过自定义坐标轴动态传入一个data数据对象(可能是参照Lines的坐标串,如[{coords:[[x,y],[x,y],...]}]
 
或者直接传一个geoJson对象),到renderItem那边怎么接收这个信息进行渲染,查看可dataSet以及lines的相关示例都没有找到解决方法,我看了官网的例子也只有传点数据过去的,如这两个例子(http://echarts.baidu.com/examples/editor.html?c=custom-hexbin,http://echarts.baidu.com/examples/editor.html?c=custom-wind),还有一些例子直接就没传数据,直接在renderItem下定义了常量,如(http://echarts.baidu.com/examples/editor.html?c=map-polygon),这样使用就不能根据传数据进行动态更新了。。。
   
   
   
   
   ### Version & Environment [版本及环境]
   + ECharts version [ECharts 版本]:4.1.0
   + Browser version [浏览器类型和版本]:Chrome 版本 66.0.3359.181(正式版本) (64 位)
   + OS Version [操作系统类型和版本]:Win 10 64Bit
   
   
   
   
   
   ### Expected behaviour [期望结果]
   
   通过series里的data动态传入数据到renderItem函数解析
   
   
   
   ### ECharts option [ECharts配置项]
   <!-- Copy and paste your 'echarts option' here. -->
   <!-- [下方贴你的option,注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。最好是我们能够直接运行的 
option。如何得到能运行的 option 参见上方的 guidelines for contributing] -->
   ```javascript
   option = {
   
       bmap: {
           center: [104.114129, 37.550339],
           zoom: 5,
           roam: true
       },
       series : [
           {
               type: 'custom',
               coordinateSystem: 'bmap',
               renderItem: function (params, api) {
       //如何解析传入的data,类似{points:[[x,y],[x,y]...]}
       var coords = [
           [116.7,39.53],
           [103.73,36.03],
           [112.91,27.87],
           [120.65,28.01],
           [119.57,39.95]
       ];
       var points = [];
       for (var i = 0; i < coords.length; i++) {
           points.push(api.coord(coords[i]));
       }
       var color = api.visual('color');
   
       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: color,
               stroke: echarts.color.lift(color)
           })
       };
   },
                itemStyle: {
                   normal: {
                       opacity: 0.5
                   }
               },
               data: [0]//data 怎么在这边传入
           }
       ]
   }
   
   ```
   
   
   
   
   ### Other comments [其他信息]
   <!-- For example: Screenshot or Online demo -->
   <!-- [例如,截图或线上实例 (JSFiddle/JSBin/Codepen)] -->
   
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

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

Reply via email to