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

[Bug] Sankey桑基图 Label formmater中的value是undefined,而Tooltip缺有值 #18212

Closed
TommysLee opened this issue Jan 30, 2023 · 4 comments · Fixed by #18733
Closed

[Bug] Sankey桑基图 Label formmater中的value是undefined,而Tooltip缺有值 #18212

TommysLee opened this issue Jan 30, 2023 · 4 comments · Fixed by #18733

Comments

@TommysLee
Copy link
Contributor

Version

5.4.1

Link to Minimal Reproduction

No response

Steps to Reproduce

桑基图中 Label Formater的value为空
而Tooltip Formatter的value值 是有的 且与实际相符

是否可以将这两个值统一一下,两边都可以拿到值,而不是一边有值,一遍undefined

Current Behavior

最终,我要实现的效果就是,在图上 Label 显示的value值 和 Tooltip的value值 是一致的,但我现在做不到。

Expected Behavior

最终,我要实现的效果就是,在图上 Label 显示的value值 和 Tooltip的value值 是一致的,但我现在做不到。

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

@TommysLee TommysLee added the bug label Jan 30, 2023
@TommysLee
Copy link
Contributor Author

我在Label formmater的 params中 拿不到value 是undefined,该如何做呢?

@TommysLee
Copy link
Contributor Author

此Bug我已解决,代码如下:

源文件:echarts.js

代码行:15239 修改为如下代码:

if (labelFetcher) {
    /*
     * 2023-01-30
     * 添加如下代码,用于解决桑基图Label Value为undefined的问题
     */
    let extendParams = null;
    if (labelFetcher instanceof SankeySeriesModel && value != undefined && value != null) {
        extendParams = {interpolatedValue:value}
    }

    baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, normalModel && normalModel.get('formatter'), interpolatedValue != null ? {
        interpolatedValue: interpolatedValue
    } : extendParams);
}

代码行:65439 修改为如下代码:

setLabelStyle(rect, getLabelStatesModels(itemModel), {
    labelFetcher: seriesModel,
    labelDataIndex: node.dataIndex,
    defaultText: node.id,
    value: node.getLayout().value // 2023-01-30 解决:桑基图Label value是undefined的问题,此处将真实值抛出去
});

@susiwen8
Copy link
Contributor

susiwen8 commented Feb 1, 2023

Thanks, Could you submit a PR?

@TommysLee
Copy link
Contributor Author

I'm a little busy these two days, please take some time to deal with it.
Thanks

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

Successfully merging a pull request may close this issue.

4 participants