You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "Honey-Xin (via GitHub)" <gi...@apache.org> on 2023/05/29 02:39:49 UTC

[GitHub] [echarts] Honey-Xin opened a new issue, #18676: [Bug] 如何获取树状图的父节点?

Honey-Xin opened a new issue, #18676:
URL: https://github.com/apache/echarts/issues/18676

   ### Version
   
   5.2.2
   
   ### Link to Minimal Reproduction
   
   ad
   
   ### Steps to Reproduce
   
   var myChart = echarts.init(document.getElementById('main'));
   var data = 
   {"name": "flare",
   "children": [
   {
   "name": "analytics",
   "children": [
   {
   "name": "cluster",
   "children": [
   {"name": "AgglomerativeCluster", "value": 3938},
   {"name": "CommunityStructure", "value": 3812},
   {"name": "HierarchicalCluster", "value": 6714},
   {"name": "MergeEdge", "value": 743}
   ]
   },
   {
   "name": "graph",
   "children": [
   {"name": "BetweennessCentrality", "value": 3534},
   {"name": "LinkDistance", "value": 5731},
   {"name": "MaxFlowMinCut", "value": 7840},
   {"name": "ShortestPaths", "value": 5914},
   {"name": "SpanningTree", "value": 3416}],
   },
   ],},]
   }
   	myChart.showLoading();
   	myChart.hideLoading();
   	var option = {
         tooltip: {
           trigger: 'item',
           triggerOn: 'mousemove'
         },
         series: [
           {
   			// edgeShape: 'polyline',
   		nodeGap:-100,
             type: 'tree',
             data: [data],
             left: '2%',
             right: '2%',
             top: '8%',
   		initialTreeDepth: 1, // 初始展开两层
             bottom: '20%',
             symbol: 'emptyCircle',
             orient: 'vertical',
             expandAndCollapse: true,
             label: {
               position: 'top',
               // rotate: 0,
               // verticalAlign: 'middle',
               // align: 'right',
               fontSize: 18,
   			// color:#fff
             },
             leaves: {
               label: {
                 position: 'bottom',
                 rotate: -45,
                 // verticalAlign: 'middle',
                 // align: 'left'
               }
             },
             animationDurationUpdate: 750
           }
         ]
       }
   	// 树状图点击事件
   	myChart.on('click', function (params) {
   	  // 获取当前点击的节点信息
   		var node = params.data;
   		console.log(params.data)
   		alert(node.name+'+');
   	});
   	
   	
   	
   	
   	myChart.setOption(option);
   
   ### Current Behavior
   
   无法获取父节点信息。
   
   ### Expected Behavior
   
   希望点击当前节点可以打印出父节点信息。
   
   ### Environment
   
   ```markdown
   - OS:
   - Browser:
   - Framework:
   ```
   
   
   ### Any additional comments?
   
   _No response_


-- 
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.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


[GitHub] [echarts] plainheart closed issue #18676: [Bug] 如何获取树状图的父节点?

Posted by "plainheart (via GitHub)" <gi...@apache.org>.
plainheart closed issue #18676: [Bug] 如何获取树状图的父节点?
URL: https://github.com/apache/echarts/issues/18676


-- 
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


[GitHub] [echarts] echarts-bot[bot] commented on issue #18676: [Bug] 如何获取树状图的父节点?

Posted by "echarts-bot[bot] (via GitHub)" <gi...@apache.org>.
echarts-bot[bot] commented on issue #18676:
URL: https://github.com/apache/echarts/issues/18676#issuecomment-1566413114

   @Honey-Xin It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
   <details><summary><b>TRANSLATED</b></summary><br>
   
   **TITLE**
   
   [Bug] How do I get the parent node of the treemap?
   </details>


-- 
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


[GitHub] [echarts] plainheart commented on issue #18676: [Bug] 如何获取树状图的父节点?

Posted by "plainheart (via GitHub)" <gi...@apache.org>.
plainheart commented on issue #18676:
URL: https://github.com/apache/echarts/issues/18676#issuecomment-1567033515

   点击事件回调参数 `params` 里有一个 `treeAncestors` 属性,可以用来获取当前节点的祖先节点(包括自身)。


-- 
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