You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/08/01 07:15:19 UTC
[GitHub] [echarts] ElayGelbart opened a new pull request, #17451: feat(graph) full path emphasis. close #17448
ElayGelbart opened a new pull request, #17451:
URL: https://github.com/apache/echarts/pull/17451
Graph Emphasis Full Path:
This pull request is in the type of:
- [ ] bug fixing
- [x] new feature
- [ ] others
this pull request adding the functionality to emphasis the full path from start to finish on hover/highlight event
### Fixed issues
- #17448
## Details
### Before: What was the problem?
There was only three options, 'self','series','adjacency'. it was needed to emphasis the whole path of nodes/edges to highlight all the related paths to specific node/edge
'adjacency' provide only one before one after emphasis.

### After: How does it behave after the fixing?
after we can have 'fullPath' option on emphasis:focus
```js
chart.setOption({
series: [
{
type: 'sankey',
nodes: data.nodes,
links: data.links,
lineStyle: {
color: 'gradient',
curveness: 0.5
},
emphasis: {
focus: 'fullPath'
}
}
]
});
```

## Document Info
One of the following should be checked.
- [ ] This PR doesn't relate to document changes
- [x] The document should be updated later
- [ ] The document changes have been made in apache/echarts-doc#xxx
## Misc
### ZRender Changes
- [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
### Related test cases or examples to use the new APIs
Please refer to `test/emphasis-fullPath.html`
## Others
### Merging options
- [ ] Please squash the commits into a single one when merging.
### Other information
--
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] ElayGelbart commented on pull request #17451: feat(graph) full path emphasis. close #17448
Posted by GitBox <gi...@apache.org>.
ElayGelbart commented on PR #17451:
URL: https://github.com/apache/echarts/pull/17451#issuecomment-1345264627
Is there any release date for this PR merge ?
--
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] lhd163 commented on pull request #17451: feat(sankey): support `trajectory` for emphasis state
Posted by "lhd163 (via GitHub)" <gi...@apache.org>.
lhd163 commented on PR #17451:
URL: https://github.com/apache/echarts/pull/17451#issuecomment-1707770536
发现个问题:focus 配置为 'trajectory' 时,当节点数 data,超过 100 ,边 links 超过 300 的时候,会导致页面崩溃
--
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] ElayGelbart commented on a diff in pull request #17451: feat(graph) full path emphasis. close #17448
Posted by GitBox <gi...@apache.org>.
ElayGelbart commented on code in PR #17451:
URL: https://github.com/apache/echarts/pull/17451#discussion_r958594939
##########
src/chart/graph/GraphSeries.ts:
##########
@@ -69,7 +69,7 @@ export interface GraphNodeStateOption<TCbParams = never> {
interface ExtraEmphasisState {
- focus?: DefaultEmphasisFocus | 'adjacency'
+ focus?: DefaultEmphasisFocus | 'adjacency' | 'fullPath'
Review Comment:
what about `trajectory`? or just `full` ?
--
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 a diff in pull request #17451: feat(graph) full path emphasis. close #17448
Posted by "plainheart (via GitHub)" <gi...@apache.org>.
plainheart commented on code in PR #17451:
URL: https://github.com/apache/echarts/pull/17451#discussion_r1114118541
##########
src/chart/graph/GraphSeries.ts:
##########
@@ -69,7 +69,7 @@ export interface GraphNodeStateOption<TCbParams = never> {
interface ExtraEmphasisState {
- focus?: DefaultEmphasisFocus | 'adjacency'
+ focus?: DefaultEmphasisFocus | 'adjacency' | 'trajectory'
Review Comment:
Why do you add `'trajectory'` for the `graph` series? I think you are just adding support for the `sankey` series. If you also plan to support this feature for the `graph` series, it's not enough to only add typings.
##########
src/chart/sankey/SankeyView.ts:
##########
@@ -231,7 +231,9 @@ class SankeyView extends ChartView {
const focus = emphasisModel.get('focus');
toggleHoverEmphasis(
curve,
- focus === 'adjacency' ? edge.getAdjacentDataIndices() : focus,
+ focus === 'adjacency' ? edge.getAdjacentDataIndices()
+ : focus === 'trajectory' ? edge.getFullPathDataIndices()
+ : focus,
Review Comment:
Code style preference
```suggestion
focus === 'adjacency'
? edge.getAdjacentDataIndices()
: focus === 'trajectory'
? edge.getFullPathDataIndices()
: focus,
```
##########
src/data/Graph.ts:
##########
@@ -387,6 +387,51 @@ class GraphNode {
}
return dataIndices;
}
+
+ getFullPathDataIndices(): {node: number[], edge: number[]} {
Review Comment:
Let's keep the naming style consistent. Please use `trajectory` instead of `fullPath`.
##########
src/data/Graph.ts:
##########
@@ -387,6 +387,51 @@ class GraphNode {
}
return dataIndices;
}
+
+ getFullPathDataIndices(): {node: number[], edge: number[]} {
+ const connectedEdgesMap: {[key: number]: boolean} = {};
+ const connectedNodesMap: {[key: number]: boolean} = {};
Review Comment:
It's better to use a HashMap.
```ts
const connectedEdgesMap = zrUtil.createHashMap<boolean, number>();
const connectedNodesMap = zrUtil.createHashMap<boolean, number>();
```
##########
src/data/Graph.ts:
##########
@@ -429,6 +474,47 @@ class GraphEdge {
node: [this.node1.dataIndex, this.node2.dataIndex]
};
}
+
+ getFullPathDataIndices(): {node: number[], edge: number[]} {
+ const connectedEdgesMap: {[key: number]: boolean} = {};
+ const connectedNodesMap: {[key: number]: boolean} = {};
Review Comment:
The same to the above comments.
##########
test/emphasis-fullPath.html:
##########
@@ -0,0 +1,62 @@
+
Review Comment:
nitpick: It would be better if we rename this test case to `sankey-emphasis.html` and add a child case named `emphasis: 'trajectory'`. You can refer to `test/sankey.html`.
##########
src/chart/sankey/SankeyView.ts:
##########
@@ -283,7 +285,9 @@ class SankeyView extends ChartView {
const focus = emphasisModel.get('focus');
toggleHoverEmphasis(
rect,
- focus === 'adjacency' ? node.getAdjacentDataIndices() : focus,
+ focus === 'adjacency' ? node.getAdjacentDataIndices()
+ : focus === 'trajectory' ? node.getFullPathDataIndices()
+ : focus,
Review Comment:
Code style preference
```suggestion
focus === 'adjacency'
? node.getAdjacentDataIndices()
: focus === 'trajectory'
? node.getFullPathDataIndices()
: focus,
```
##########
src/data/Graph.ts:
##########
@@ -429,6 +474,47 @@ class GraphEdge {
node: [this.node1.dataIndex, this.node2.dataIndex]
};
}
+
+ getFullPathDataIndices(): {node: number[], edge: number[]} {
Review Comment:
Please use `trajectory` instead of `fullPath`.
##########
src/data/Graph.ts:
##########
@@ -387,6 +387,51 @@ class GraphNode {
}
return dataIndices;
}
+
+ getFullPathDataIndices(): {node: number[], edge: number[]} {
+ const connectedEdgesMap: {[key: number]: boolean} = {};
+ const connectedNodesMap: {[key: number]: boolean} = {};
+
+ for (let i = 0; i < this.edges.length; i++) {
+ const adjacentEdge = this.edges[i];
+ if (adjacentEdge.dataIndex < 0) {
+ continue;
+ }
+
+ connectedEdgesMap[adjacentEdge.dataIndex] = true;
+
+ const sourceNodesQueue = [adjacentEdge.node1];
+ const targetNodesQueue = [adjacentEdge.node2];
+
+ let nodeIteratorIndex = 0;
+ while (nodeIteratorIndex < sourceNodesQueue.length) {
+ const sourceNode = sourceNodesQueue[nodeIteratorIndex];
+ nodeIteratorIndex++;
+ connectedNodesMap[sourceNode.dataIndex] = true;
+
+ for (let j = 0; j < sourceNode.inEdges.length; j++) {
+ connectedEdgesMap[sourceNode.inEdges[j].dataIndex] = true;
+ sourceNodesQueue.push(sourceNode.inEdges[j].node1);
+ }
+ }
+
+ nodeIteratorIndex = 0;
+ while (nodeIteratorIndex < targetNodesQueue.length) {
+ const targetNode = targetNodesQueue[nodeIteratorIndex];
+ nodeIteratorIndex++;
+ connectedNodesMap[targetNode.dataIndex] = true;
+ for (let j = 0; j < targetNode.outEdges.length; j++) {
+ connectedEdgesMap[targetNode.outEdges[j].dataIndex] = true;
+ targetNodesQueue.push(targetNode.outEdges[j].node2);
+ }
+ }
+ }
+
+ return {
+ edge: Object.keys(connectedEdgesMap).map(Number),
+ node: Object.keys(connectedNodesMap).map(Number)
Review Comment:
Just use `connectedEdgesMap.keys()` and `connectedNodesMap.keys()`
##########
src/data/Graph.ts:
##########
@@ -429,6 +474,47 @@ class GraphEdge {
node: [this.node1.dataIndex, this.node2.dataIndex]
};
}
+
+ getFullPathDataIndices(): {node: number[], edge: number[]} {
+ const connectedEdgesMap: {[key: number]: boolean} = {};
+ const connectedNodesMap: {[key: number]: boolean} = {};
+
+ connectedEdgesMap[this.dataIndex] = true;
+
+ const sourceNodes = [this.node1];
+ const targetNodes = [this.node2];
+
+ let nodeIteratorIndex = 0;
+ while (nodeIteratorIndex < sourceNodes.length) {
+ const sourceNode = sourceNodes[nodeIteratorIndex];
+ nodeIteratorIndex++;
+
+ connectedNodesMap[sourceNode.dataIndex] = true;
+
+ for (let j = 0; j < sourceNode.inEdges.length; j++) {
+ connectedEdgesMap[sourceNode.inEdges[j].dataIndex] = true;
+ sourceNodes.push(sourceNode.inEdges[j].node1);
+ }
+ }
+
+ nodeIteratorIndex = 0;
+ while (nodeIteratorIndex < targetNodes.length) {
+ const targetNode = targetNodes[nodeIteratorIndex];
+ nodeIteratorIndex++;
+
+ connectedNodesMap[targetNode.dataIndex] = true;
+
+ for (let j = 0; j < targetNode.outEdges.length; j++) {
+ connectedEdgesMap[targetNode.outEdges[j].dataIndex] = true;
+ targetNodes.push(targetNode.outEdges[j].node2);
+ }
+ }
+
+ return {
+ edge: Object.keys(connectedEdgesMap).map(Number),
+ node: Object.keys(connectedNodesMap).map(Number)
Review Comment:
The same to the above comments.
--
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 pull request #17451: feat(sankey): support `trajectory` for emphasis state
Posted by "plainheart (via GitHub)" <gi...@apache.org>.
plainheart commented on PR #17451:
URL: https://github.com/apache/echarts/pull/17451#issuecomment-1713829392
@lhd163 Thanks for your feedback. Please file a bug report with a reproduction example.
--
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] Ovilia merged pull request #17451: feat(sankey): support `trajectory` for emphasis state
Posted by "Ovilia (via GitHub)" <gi...@apache.org>.
Ovilia merged PR #17451:
URL: https://github.com/apache/echarts/pull/17451
--
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] ElayGelbart commented on pull request #17451: feat(graph) full path emphasis. close #17448
Posted by "ElayGelbart (via GitHub)" <gi...@apache.org>.
ElayGelbart commented on PR #17451:
URL: https://github.com/apache/echarts/pull/17451#issuecomment-1438614770
@Ovilia @theBstar
Code is updated to improve performance :)
--
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] ElayGelbart commented on pull request #17451: feat(graph) full path emphasis. close #17448
Posted by GitBox <gi...@apache.org>.
ElayGelbart commented on PR #17451:
URL: https://github.com/apache/echarts/pull/17451#issuecomment-1224019631
Hey I know you're busy, when this will get review ?
--
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] theBstar commented on pull request #17451: feat(graph) full path emphasis. close #17448
Posted by "theBstar (via GitHub)" <gi...@apache.org>.
theBstar commented on PR #17451:
URL: https://github.com/apache/echarts/pull/17451#issuecomment-1422306011
I am using this patch in my project. Thanks for the contribution (PR) 🙌 .
I was rendering a sankey with some custom tooltip & label formater function. It started becoming unresponsive, when I had ~70 nodes & ~300 edges.
I have made a few changes in your code (no change in logic) to decrease memory allocations (array shift & push) & indexOf checks (which is O(n)). Sharing both functions after changes below
```js
GraphNode.prototype.getFullPathDataIndices = function () {
const connectedEdgesMap = {};
const connectedNodesMap = {};
for (let i = 0; i < this.edges.length; i++) {
const adjacentEdge = this.edges[i];
if (adjacentEdge.dataIndex < 0) {
continue;
}
connectedEdgesMap[adjacentEdge.dataIndex] = true;
const sourceNodesQueue = [adjacentEdge.node1];
const targetNodesQueue = [adjacentEdge.node2];
let nodeIteratorIndex = 0;
while (nodeIteratorIndex < sourceNodesQueue.length) {
const sourceNode = sourceNodesQueue[nodeIteratorIndex];
nodeIteratorIndex++;
connectedNodesMap[sourceNode.dataIndex] = true;
for (let j = 0; j < sourceNode.inEdges.length; j++) {
connectedEdgesMap[sourceNode.inEdges[j].dataIndex] = true;
sourceNodesQueue.push(sourceNode.inEdges[j].node1);
}
}
nodeIteratorIndex = 0;
while (nodeIteratorIndex < targetNodesQueue.length) {
const targetNode = targetNodesQueue[nodeIteratorIndex];
nodeIteratorIndex++;
connectedNodesMap[targetNode.dataIndex] = true;
for (let j = 0; j < targetNode.outEdges.length; j++) {
connectedEdgesMap[targetNode.outEdges[j].dataIndex] = true;
targetNodesQueue.push(targetNode.outEdges[j].node2);
}
}
}
return {
edge: Object.keys(connectedEdgesMap),
node: Object.keys(connectedNodesMap),
};
};
```
```js
GraphEdge.prototype.getFullPathDataIndices = function () {
const connectedEdgesMap = {};
const connectedNodesMap = {};
connectedEdgesMap[this.dataIndex] = true;
const sourceNodes = [this.node1];
const targetNodes = [this.node2];
let nodeIteratorIndex = 0;
while (nodeIteratorIndex < sourceNodes.length) {
const sourceNode = sourceNodes[nodeIteratorIndex];
nodeIteratorIndex++;
connectedNodesMap[sourceNode.dataIndex] = true;
for (let j = 0; j < sourceNode.inEdges.length; j++) {
connectedEdgesMap[sourceNode.inEdges[j].dataIndex] = true;
sourceNodes.push(sourceNode.inEdges[j].node1);
}
}
nodeIteratorIndex = 0;
while (nodeIteratorIndex < targetNodes.length) {
const targetNode = targetNodes[nodeIteratorIndex];
nodeIteratorIndex++;
connectedNodesMap[targetNode.dataIndex] = true;
for (let j = 0; j < targetNode.outEdges.length; j++) {
connectedEdgesMap[targetNode.outEdges[j].dataIndex] = true;
targetNodes.push(targetNode.outEdges[j].node2);
}
}
return {
edge: Object.keys(connectedEdgesMap),
node: Object.keys(connectedNodesMap),
};
};
```
--
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] ElayGelbart commented on pull request #17451: feat(graph) full path emphasis. close #17448
Posted by GitBox <gi...@apache.org>.
ElayGelbart commented on PR #17451:
URL: https://github.com/apache/echarts/pull/17451#issuecomment-1200852369
* https://github.com/apache/echarts-doc/pull/276
* echarts-doc pull request adding changes
--
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 pull request #17451: feat(graph) full path emphasis. close #17448
Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on PR #17451:
URL: https://github.com/apache/echarts/pull/17451#issuecomment-1200808161
Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout [the coding standard](https://echarts.apache.org/en/coding-standard.html) and Wiki about [How to make a pull request](https://github.com/apache/echarts/wiki/How-to-make-a-pull-request).
Document changes are required in this PR. Please also make a PR to [apache/echarts-doc](https://github.com/apache/echarts-doc) for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the `PR: awaiting doc` label.
--
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 pull request #17451: feat(sankey): support `trajectory` for emphasis state
Posted by "plainheart (via GitHub)" <gi...@apache.org>.
plainheart commented on PR #17451:
URL: https://github.com/apache/echarts/pull/17451#issuecomment-1455408428
@Ovilia I agree with @ElayGelbart. It's a bit hard to see but they do connect with a very thin line.
--
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] Ovilia commented on a diff in pull request #17451: feat(graph) full path emphasis. close #17448
Posted by GitBox <gi...@apache.org>.
Ovilia commented on code in PR #17451:
URL: https://github.com/apache/echarts/pull/17451#discussion_r954746068
##########
src/chart/graph/GraphSeries.ts:
##########
@@ -69,7 +69,7 @@ export interface GraphNodeStateOption<TCbParams = never> {
interface ExtraEmphasisState {
- focus?: DefaultEmphasisFocus | 'adjacency'
+ focus?: DefaultEmphasisFocus | 'adjacency' | 'fullPath'
Review Comment:
Do you have other suggestions for the name of this new value? We should avoid using two words because developers may misspell it to be `'fullpath'`.
##########
src/chart/sankey/SankeyView.ts:
##########
@@ -231,7 +231,9 @@ class SankeyView extends ChartView {
const focus = emphasisModel.get('focus');
toggleHoverEmphasis(
curve,
- focus === 'adjacency' ? edge.getAdjacentDataIndices() : focus,
+ focus === 'adjacency' ? edge.getAdjacentDataIndices()
+ : focus === 'fullPath' ? edge.getFullPathDataIndices()
+ : focus,
Review Comment:
Since we are using this logic for multiple times, please consider making a function to reuse.
##########
src/data/Graph.ts:
##########
@@ -387,6 +387,49 @@ class GraphNode {
}
return dataIndices;
}
+
+ getFullPathDataIndices(): {node: number[], edge: number[]} {
+ const dataIndices = {
+ edge: [] as number[],
+ node: [] as number[]
+ };
+
+ for (let i = 0; i < this.edges.length; i++) {
+ const adjacentEdge = this.edges[i];
+ if (adjacentEdge.dataIndex < 0) {
+ continue;
+ }
+
+ dataIndices.edge.indexOf(adjacentEdge.dataIndex) === -1
+ ? dataIndices.edge.push(adjacentEdge.dataIndex) : null;
Review Comment:
Use `zrUtil.indexOf` instead of `indexOf`
--
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] ElayGelbart commented on pull request #17451: feat(sankey): support `trajectory` for emphasis state
Posted by "ElayGelbart (via GitHub)" <gi...@apache.org>.
ElayGelbart commented on PR #17451:
URL: https://github.com/apache/echarts/pull/17451#issuecomment-1440365332
@plainheart Fixed code by your recommendations
--
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 pull request #17451: feat(sankey): support `trajectory` for emphasis state
Posted by "echarts-bot[bot] (via GitHub)" <gi...@apache.org>.
echarts-bot[bot] commented on PR #17451:
URL: https://github.com/apache/echarts/pull/17451#issuecomment-1461533148
Congratulations! Your PR has been merged. Thanks for your contribution! 👍
--
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] ElayGelbart commented on a diff in pull request #17451: feat(graph) full path emphasis. close #17448
Posted by GitBox <gi...@apache.org>.
ElayGelbart commented on code in PR #17451:
URL: https://github.com/apache/echarts/pull/17451#discussion_r958631670
##########
src/chart/sankey/SankeyView.ts:
##########
@@ -231,7 +231,9 @@ class SankeyView extends ChartView {
const focus = emphasisModel.get('focus');
toggleHoverEmphasis(
curve,
- focus === 'adjacency' ? edge.getAdjacentDataIndices() : focus,
+ focus === 'adjacency' ? edge.getAdjacentDataIndices()
+ : focus === 'fullPath' ? edge.getFullPathDataIndices()
+ : focus,
Review Comment:
node and edge function look similar but invoke different function.
--
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] Ovilia commented on a diff in pull request #17451: feat(graph) full path emphasis. close #17448
Posted by GitBox <gi...@apache.org>.
Ovilia commented on code in PR #17451:
URL: https://github.com/apache/echarts/pull/17451#discussion_r1046902863
##########
test/emphasis-fullPath.html:
##########
@@ -0,0 +1,62 @@
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <script src="lib/simpleRequire.js"></script>
+ <script src="lib/config.js"></script>
+ <script src="lib/jquery.min.js"></script>
+ </head>
+ <body>
+ <style>
+ html, body, #main {
+ width: 100%;
+ height: 100%;
+ }
+ </style>
+ <div id="main"><div>
+ <script>
+ require([
+ 'echarts',
+ './data/energy.json'
+ ], function (echarts, data) {
+ var chart = echarts.init(document.getElementById('main'));
+ chart.setOption({
+ series: [
+ {
+ type: 'sankey',
+ nodes: data.nodes,
+ links: data.links,
+ lineStyle: {
+ color: 'gradient',
+ curveness: 0.5
+ },
+ emphasis: {
+ focus: 'fullPath'
Review Comment:
I didn't see the logic of `fullPath`. Did I miss something or do you mean `trajectory`?
##########
src/data/Graph.ts:
##########
@@ -429,6 +472,40 @@ class GraphEdge {
node: [this.node1.dataIndex, this.node2.dataIndex]
};
}
+
+ getFullPathDataIndices(): {node: number[], edge: number[]} {
+ const dataIndices = {
Review Comment:
These logic looks pretty like the above code. Can we reuse them?
##########
src/data/Graph.ts:
##########
@@ -387,6 +387,49 @@ class GraphNode {
}
return dataIndices;
}
+
+ getFullPathDataIndices(): {node: number[], edge: number[]} {
+ const dataIndices = {
+ edge: [] as number[],
+ node: [] as number[]
+ };
+
+ for (let i = 0; i < this.edges.length; i++) {
+ const adjacentEdge = this.edges[i];
+ if (adjacentEdge.dataIndex < 0) {
+ continue;
+ }
+
+ zrUtil.indexOf(dataIndices.edge, adjacentEdge.dataIndex) < 0
+ ? dataIndices.edge.push(adjacentEdge.dataIndex) : null;
Review Comment:
```
if (zrUtil.indexOf(dataIndices.edge, adjacentEdge.dataIndex) < 0) {
dataIndices.edge.push(adjacentEdge.dataIndex);
}
```
is probably clearer.
##########
src/data/Graph.ts:
##########
@@ -387,6 +387,49 @@ class GraphNode {
}
return dataIndices;
}
+
+ getFullPathDataIndices(): {node: number[], edge: number[]} {
+ const dataIndices = {
+ edge: [] as number[],
+ node: [] as number[]
+ };
+
+ for (let i = 0; i < this.edges.length; i++) {
+ const adjacentEdge = this.edges[i];
+ if (adjacentEdge.dataIndex < 0) {
+ continue;
+ }
+
+ zrUtil.indexOf(dataIndices.edge, adjacentEdge.dataIndex) < 0
+ ? dataIndices.edge.push(adjacentEdge.dataIndex) : null;
Review Comment:
The same for other problems in the following code.
--
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] ElayGelbart commented on pull request #17451: feat(graph) full path emphasis. close #17448
Posted by GitBox <gi...@apache.org>.
ElayGelbart commented on PR #17451:
URL: https://github.com/apache/echarts/pull/17451#issuecomment-1378767507
This feature is ready to release in Feb or there are other requested changes ?
--
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] ElayGelbart commented on pull request #17451: feat(sankey): support `trajectory` for emphasis state
Posted by "ElayGelbart (via GitHub)" <gi...@apache.org>.
ElayGelbart commented on PR #17451:
URL: https://github.com/apache/echarts/pull/17451#issuecomment-1455016973
> I think this is a bug, right? <img alt="image" width="819" src="https://user-images.githubusercontent.com/779050/222693405-1c2e6e76-98eb-418a-9f8b-6d41a925af89.png">
Hey @Ovilia , This is not a bug, `Liquid` node is connected to `Bio-conversion` node...
--
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