apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.12k stars 19.6k forks source link

Add option to automatically assign label position for sankey node labels #12890

Closed dominic-simplan closed 3 months ago

dominic-simplan commented 4 years ago

What problem does this feature solve?

There are many options for configuration a sankey label position: https://echarts.apache.org/en/option.html#series-sankey.label.position. However, using the left or the right option, the labels might not be visible if the nodes are at the corner of the diagram. grafik

An additional option which automatically finds the best position for the label (e.g. right, if the node is on the left half of the diagram, and left, if the node is on the right half of the diagram) would be useful. grafik

What does the proposed API look like?

label.position = "auto"

echarts-bot[bot] commented 4 years ago

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 dev@echarts.apache.org. 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! 🍵

albcunha commented 2 years ago

In case someone like me, with the same problem, reaches this suggestion, there is a manual workaround.

You can set label position dynamically on the node. So, on the nodes on the right, instead of:

{
name: "node on the right side"
}

you do this:

{
name: "node on the right side",
label: {position: "left"}
}

Also, on options -> series, you can set the padding you want. So, you can set left:0, right:0 for a full sankey chart. Example:

series: [
      {
        type: "sankey",
        right: 0,
        left: 0,
        data: nodes,
        links: links,
        lineStyle: {
          color: "source",
          curveness: 0.5,
        },
      },
    ],
github-actions[bot] commented 3 months ago

This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.

github-actions[bot] commented 3 months ago

This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!