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

关系图(graph)自定义node的tooltip,导致edge的tooltip显示错误 #12220

Closed
cometor opened this issue Mar 2, 2020 · 2 comments
Closed
Labels

Comments

@cometor
Copy link

cometor commented Mar 2, 2020

Version

4.4.0

Steps to reproduce

My option is like this:

option = {
    tooltip: {},
    series: [
        {
            type: 'graph',
            layout: 'none',
            symbolSize: 50,
            label: {
                show: true
            },
            data: [{
                name: 'A',
                x: 100,
                y: 100,
                tooltip: {
                  formatter :function(params) {
                      return 'this is A'
                  }    
                }
            }, {
                name: 'B',
                x: 300,
                y: 200
            }, {
                name: 'C',
                x: 50,
                y: 250
            }],
            links: [
                {
                source: 'B',
                target: 'C'
            },{
                source: 'B',
                target: 'A'
            }, {
                source: 'A',
                target: 'C'
            }]
        }
    ]
};

the actual chart is like this

I debugged it and found an error in \src\component\tooltip\TooltipView.js

    _showSeriesItemTooltip: function (e, el, dispatchAction) {
        var ecModel = this._ecModel;
        // Use dataModel in element if possible
        // Used when mouseover on a element like markPoint or edge
        // In which case, the data is not main data in series.
        var seriesIndex = el.seriesIndex;
        var seriesModel = ecModel.getSeriesByIndex(seriesIndex);

        // For example, graph link.
        var dataModel = el.dataModel || seriesModel;
        var dataIndex = el.dataIndex;
        var dataType = el.dataType;
        var data = dataModel.getData();

dataModel.getData() always return the data of nodes, but not edges.

What is expected?

when hover to the edge 'B>C',the tooltip is ‘B>C’

What is actually happening?

when hover to the edge 'B>C',the tooltip is ‘this is A’

@echarts-bot
Copy link

echarts-bot bot commented Mar 2, 2020

Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.

If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to [email protected]. Please attach the issue link if it's a technical questions.

If you are interested in the project, you may also subscribe our mail list.

Have a nice day! 🍵

@echarts-bot echarts-bot bot added bug pending We are not sure about whether this is a bug/new feature. waiting-for: community labels Mar 2, 2020
@susiwen8
Copy link
Contributor

susiwen8 commented Mar 2, 2020

Known issue, will be fixed in 4.8.0, related PR is #12011

@susiwen8 susiwen8 closed this as completed Mar 2, 2020
@susiwen8 susiwen8 removed the pending We are not sure about whether this is a bug/new feature. label Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants