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 2019/05/07 02:46:12 UTC

[GitHub] [incubator-echarts] alecthw opened a new issue #10404: Tree树形图中,series[i]-tree.symbol 使用 function 时报错

alecthw opened a new issue #10404: Tree树形图中,series[i]-tree.symbol 使用 function 时报错
URL: https://github.com/apache/incubator-echarts/issues/10404
 
 
   ### Version
   4.2.1
   
   ### Steps to reproduce
   根据配置项手册 https://echarts.baidu.com/option.html#series-tree.symbol ,symbol可以定义为函数,返回不同的图片。
   ``` js
   symbol: (value, params) => {
     console.log('radialTreeOptions', value, params);
     return [`image://https://seeklogo.com/images/E/elasticsearch-logo-C75C4578EC-seeklogo.com.png`];
   }
   ```
   报错如下:
   Uncaught TypeError: symbolType.indexOf is not a function
       at createSymbol (webpack-internal:///./node_modules/echarts/lib/util/symbol.js:309)
       at SymbolClz.symbolProto._createSymbol (webpack-internal:///./node_modules/echarts/lib/chart/helper/Symbol.js:104)
       at SymbolClz.symbolProto.updateData (webpack-internal:///./node_modules/echarts/lib/chart/helper/Symbol.js:209)
       at new SymbolClz (webpack-internal:///./node_modules/echarts/lib/chart/helper/Symbol.js:69)
       at updateNode (webpack-internal:///./node_modules/echarts/lib/chart/tree/TreeView.js:317)
       at DataDiffer.eval [as _add] (webpack-internal:///./node_modules/echarts/lib/chart/tree/TreeView.js:131)
       at DataDiffer.execute (webpack-internal:///./node_modules/echarts/lib/data/DataDiffer.js:132)
       at ExtendedClass.render (webpack-internal:///./node_modules/echarts/lib/chart/tree/TreeView.js:153)
       at Task.progress (webpack-internal:///./node_modules/echarts/lib/view/Chart.js:276)
       at doProgress (webpack-internal:///./node_modules/echarts/lib/stream/task.js:217)
   
   跟源代码可见,这里没有处理 symbolType 为 function 的情况
   function createSymbol(symbolType, x, y, w, h, color, keepAspect) {
     // TODO Support image object, DynamicImage.
     var isEmpty = symbolType.indexOf('empty') === 0;
   
     if (isEmpty) {
       symbolType = symbolType.substr(5, 1).toLowerCase()   symbolType.substr(6);
     }
   
   ### What is expected?
   根据回调函数实现返回不同的图片
   
   ### What is actually happening?
   抛出异常报错
   
   <!-- This issue is generated by echarts-issue-helper. 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:
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