pissang commented on a change in pull request #11556: fix tree diagram leaves label formatter don't work #11385 #8534 URL: https://github.com/apache/incubator-echarts/pull/11556#discussion_r343021072
########## File path: src/chart/tree/TreeSeries.js ########## @@ -47,7 +47,18 @@ export default SeriesModel.extend({ treeOption.leaves = leaves; - var tree = Tree.createTree(root, this, treeOption); + var tree = Tree.createTree(root, this, treeOption, beforeLink); + + function beforeLink(nodeData) { + nodeData.wrapMethod('getItemModel', function (model, idx) { + var node = tree.getNodeByDataIndex(idx); + var leavesModel = node.getLeavesModel(); + if (node.children.length === 0 || (node.children.length !== 0 && node.isExpand === false)) { Review comment: A small code optimization suggestion. I think this can be simplify to ```js if (!node.children.length || !node. isExpand) { } ``` ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org