<!--
为了方便我们能够复现和修复 bug,请遵从下面的规范描述您的问题。
-->


### One-line summary [问题简述]

Since selecting a legend category seems to change a graph node's `dataIndex`, I 
would like to be able to access a node's `dataIndex` by its ID.

### Version & Environment [版本及环境]
+ ECharts version [ECharts 版本]: eCharts 4.2.0-rc1
+ Browser version [浏览器类型和版本]: Google Chrome 69
+ OS Version [操作系统类型和版本]: Mac OS X 10.14 Mojave

### Expected behaviour [期望结果]

I have found a `getNodeById` function in the source code, which is the sort of 
thing I would like to have--find a node's `dataIndex` based on its ID. But I 
can't figure out a way to use this functionality in my code.

### ECharts option [ECharts配置项]
<!-- Copy and paste your 'echarts option' here. -->
<!-- [下方贴你的option,注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。最好是我们能够直接运行的 
option。如何得到能运行的 option 参见上方的 guidelines for contributing] -->
```javascript
option = {
    title: {
      text: 'Document Reuse',
      subtext: 'Default layout',
      top: 'bottom',
      left: 'right'
    },
    tooltip: {},
    legend: [{
      data: categories.map(function(category) {
        return category.name;
      })
    }],
    animationDuration: 1500,
    animationEasingUpdate: 'quinticInOut',
    series: [{
      name: 'All Links',
      type: 'graph',
      layout: 'none',
      data: graph.nodes,
      links: graph.links,
      categories: categories,
      roam: true,
      focusNodeAdjacency: true,
      itemStyle: {
        normal: {
          borderColor: '#fff',
          borderWidth: 1,
          shadowBlur: 10,
          shadowColor: 'rgba(0, 0, 0, 0.3)'
        }
      },
      label: {
        position: 'right',
        formatter: '{b}'
      },
      lineStyle: {
        color: 'source',
        curveness: 0.3
      },
      emphasis: {
        lineStyle: {
          width: 10
        }
      }
    }]
};


```

### Other comments [其他信息]
<!-- For example: Screenshot or Online demo -->
<!-- [例如,截图或线上实例 (JSFiddle/JSBin/Codepen)] -->



[ Full content available at: 
https://github.com/apache/incubator-echarts/issues/9161 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to