Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:node self pointed -add cubicBezierCurve #15405

Open
wants to merge 33 commits into
base: next
Choose a base branch
from

Conversation

HCLacids
Copy link

@HCLacids HCLacids commented Jul 22, 2021

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Fix the rendering of the edge that the target and the source is the same.
image
image
image

Fixed issues

Details

Before: What was the problem?

When the node has the self-loop-edge, it will render only one point in the previous condition that the algorithm only adapt to the quadratic bezierCurve.

After: How is it fixed in this PR?

Now the rendering method contians the cubic bezierCurve to paint the self-loop-edge.

Misc

  • The API has been changed (apache/echarts-doc#xxx).
  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

NA.

Others

Merging options

  • Please squash the commits into a single one when merge.

Other information

@echarts-bot
Copy link

echarts-bot bot commented Jul 22, 2021

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

@susiwen8
Copy link
Contributor

Please do not commit any change in dist folder. Also could you show us what problem does this PR fix?

@pissang
Copy link
Contributor

pissang commented Jul 29, 2021

@HCLacids Please don't delete the distribution files

package.json Outdated Show resolved Hide resolved
test/force.html Outdated Show resolved Hide resolved
@pissang
Copy link
Contributor

pissang commented Jul 30, 2021

Can you describe the change in more detail and add the result screenshot.

@pissang pissang added this to the 5.3 milestone Sep 2, 2021
@pull-request-size pull-request-size bot added size/L and removed size/XL labels Sep 7, 2021
@HCLacids HCLacids requested a review from 100pah September 13, 2021 01:16
test/force.html Show resolved Hide resolved
src/chart/graph/edgeVisual.ts Outdated Show resolved Hide resolved
src/chart/graph/edgeVisual.ts Outdated Show resolved Hide resolved
src/chart/graph/edgeVisual.ts Outdated Show resolved Hide resolved
src/chart/graph/adjustEdge.ts Outdated Show resolved Hide resolved
src/chart/graph/forceLayout.ts Outdated Show resolved Hide resolved
src/chart/graph/forceLayout.ts Outdated Show resolved Hide resolved
src/chart/graph/simpleLayoutHelper.ts Outdated Show resolved Hide resolved
src/chart/graph/edgeVisual.ts Outdated Show resolved Hide resolved
src/chart/graph/forceLayout.ts Outdated Show resolved Hide resolved
…2) Add test case `test/graph-self-loop.html`. (3) Remove some necessary code.
@100pah
Copy link
Member

100pah commented Sep 23, 2021

I have made a "draggable" test case to cover scenarios as much as possible.

Functional defects summary

  1. In some of the angle the direction of the self-loop edge is not expected.

Screen Shot 2021-09-24 at 4 37 10 AM

  1. When scaling the graph, the label fly to wrong place.

  2. The rotate of the the arrows are not correct.

Screen Shot 2021-09-24 at 4 39 02 AM


A PR-fix: HCLacids#1 to fix this PR

This PR-fix fixed the issue 1 above, and add test cases.

Before that PR-fix: https://echarts-try.surge.sh/graph-self-loop-old/graph-self-loop.html
After that PR-fix: https://echarts-try.surge.sh/graph-self-loop/graph-self-loop.html


About curveness

At present, the curveness can be controlled by two ways:
(A) autoCurveness: true
(B) lineStyle.curveness.
lineStyle.curveness can be set on the whole series:

series: {
    type: 'graph',
    lineStyle: {
        curveness: 0.5
    }
}

or on some certain edges:

series: {
    type: 'graph',
    edges: [{
        source: 1,
        target: 4,
        lineStyle: {
            curveness: 0.7
        }
    }, {
        source: 1
        target: 4
    }]
}

When lineStyle.curveness is set to some edge, autoCurveness will not be accepted to that edge. Basically it's implemented by code like this:

const curveness = zrUtil.retrieve3(
    edge.getModel<GraphEdgeItemOption>().get(['lineStyle', 'curveness']),
    -getCurvenessForEdge(edge, seriesModel, index, true),
    0
);
  • focus: 'adjacency'
emphasis: {
    focus: 'adjacency'
},

But I think we do not need to support autoCurveness in self-loop edges if the we accept the layout in this PR-fix.


@HCLacids Could the PR-fix be approved ?

Any issue can be discussed.

Fix and enhance graph self-loop layout.
@History-1024
Copy link

So how do you use it?

@zl2fxy
Copy link

zl2fxy commented Jan 16, 2025

When will it be updated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants