Skip to content

[Feature] Support border radius for backgroundColor image #20130

Open

Description

@princ09

Version

5.5

Link to Minimal Reproduction

https://echarts.apache.org/examples/en/editor.html?c=treemap-simple&code=PYBwLglsB2AEC8sDeAoWsDOBTAThLGAXLANprrLkWxgCeIWxA5GDllgLYCGITANFQoATLmC7Ey1aqilToXDo1hNowIVgCC_QbIBuXADYBXJQEYADANnUAxgAsIBoW2gSd1mddnzFzVeo0ubS89QxNiABZ3WQBfKxD0TwT0HyUVNU0AI2Dk9H1jJQA2aKkYkvQAXRK4kqTrVL8MgCEcr3zw2AAmS3LYe0dnLFdSXsTRigblfywmoPjc9qVu-eT-pxc3XOlx7wU06dnTVq28sKXzHYoyk6rc65Db63vqCpX0Ay5MrANiOuoAM2AOG4YDAuGI_yM0BskBgsAAFABKSgJNhgIw4OAAIiQEA4AHMAD4xLHVN4UPD2X7jPH46knTJcGwAa3xOGAUKEAGFgAYgfSTrA8Vx8Wk7KCQEQAPRSjAAZgAtBhaBxMryFXz8cAAHSsLhCCDQfG6fAAd21NmAHClbAMEC40KwCsNQiMGFY9oMzug_xwXHdOCMMIxWG1GF0-OOCRqJzsWAg-PFxAArD0TqaIEIwHYU2mtmqcOocAAlfUQN3ETrJ8bPJ7uWv3KoxADcQA

Steps to Reproduce

Run the given reporduction link or check this code


option = {
  series: [
    {
      type: 'treemap',
      data: [
        {
          name: 'nodeA',
          value: 10,
          children: [
            {
              name: 'nodeAa',
              value: 4
            },
            {
              name: 'nodeAb',
              value: 6
            }
          ]
        },
        {
          name: 'nodeB',
          value: 20,
          children: [
            {
              name: 'nodeBa',
              value: 20,
              children: [
                {
                  name: 'nodeBa1',
                  value: 20
                }
              ]
            }
          ]
        }
      ],
      label: {
        formatter: function () {
          return "{img|}"
        },
        rich: {
            img: {
              backgroundColor: {
                image: 'https://s3-symbol-logo.tradingview.com/reliance-industrial-infrastructure.svg',
              },
              height: 50,
              width: 50,
              borderRadius: 25
            }
          }
      }
    }
  ]
};

Current Behavior

Currently when set borderRadius, it not doing anything when backgroundColor is image

Expected Behavior

Image should have border radius.

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

Activity

  1. added
    en
    pending
    on Jul 8, 2024
  2. changed the title [-]Border Radius not working for backgroundColor image[Bug] [/-] [+][Bug] Border Radius not working for backgroundColor image[/+] on Jul 8, 2024
  3. added and removed
    pending
    on Jul 8, 2024
  4. plainheart commented on Jul 8, 2024

    @plainheart
    Member

    This is not a bug but it might be supported in the future. Similar to #13929.

  5. princ09 commented on Jul 8, 2024

    @princ09
    Author

    @plainheart
    Is there any work around for this?
    Bdw it's not a good idea to close issues without providing any alternative or work around for the issue.

    Echarts have very good potential but because of lack of good communities or support from developers, this library is lagging behind from other libraries like highcharts.

  6. plainheart commented on Jul 8, 2024

    @plainheart
    Member

    I closed it as it's a duplicate of known issues. I consider this as a feature that may be get supported in the future. StackOverflow is a good choice if you hope to get potential alternatives or more help. Issue list is originally for bug tracking and feature request. It's not a help center.

  7. princ09 commented on Jul 8, 2024

    @princ09
    Author

    @plainheart ,
    It's obvious that when we ask for alternatives or work around in issue, we mean alternative and work around solution available in echarts. That's also we are asking here because we have invested time to build something using this library.
    The way you response clearly shows how unsupportive the community is.

    Anyways thanks for your response.

  8. plainheart commented on Jul 9, 2024

    @plainheart
    Member

    I'm sorry what I did makes you feel that the community is unsupportive. After debugging I can see that I've made a wrong triage for this issue, it's not similar to #13929 and instead, it can be an issue of documentation. The current underlying implementation does not support setting a border radius for an image element, but I will look into it and try to support this feature in the next version 5.5.2.

    Demo for Debugging

  9. changed the title [-][Bug] Border Radius not working for backgroundColor image[/-] [+][Feature] Support border radius for backgroundColor image[/+] on Jul 9, 2024
  10. added this to the 5.5.2 milestone on Jul 9, 2024
  11. self-assigned this
    on Jul 9, 2024
  12. helgasoft commented on Jul 9, 2024

    @helgasoft

    possible duplicate of #12689, #12894

  13. modified the milestones: 5.5.2, 6.0.0 on Nov 9, 2024
  14. mintdart commented on Apr 16, 2025

    @mintdart

    Version

    5.5

    Link to Minimal Reproduction

    https://echarts.apache.org/examples/en/editor.html?c=treemap-simple&code=PYBwLglsB2AEC8sDeAoWsDOBTAThLGAXLANprrLkWxgCeIWxA5GDllgLYCGITANFQoATLmC7Ey1aqilToXDo1hNowIVgCC_QbIBuXADYBXJQEYADANnUAxgAsIBoW2gSd1mddnzFzVeo0ubS89QxNiABZ3WQBfKxD0TwT0HyUVNU0AI2Dk9H1jJQA2aKkYkvQAXRK4kqTrVL8MgCEcr3zw2AAmS3LYe0dnLFdSXsTRigblfywmoPjc9qVu-eT-pxc3XOlx7wU06dnTVq28sKXzHYoyk6rc65Db63vqCpX0Ay5MrANiOuoAM2AOG4YDAuGI_yM0BskBgsAAFABKSgJNhgIw4OAAIiQEA4AHMAD4xLHVN4UPD2X7jPH46knTJcGwAa3xOGAUKEAGFgAYgfSTrA8Vx8Wk7KCQEQAPRSjAAZgAtBhaBxMryFXz8cAAHSsLhCCDQfG6fAAd21NmAHClbAMEC40KwCsNQiMGFY9oMzug_xwXHdOCMMIxWG1GF0-OOCRqJzsWAg-PFxAArD0TqaIEIwHYU2mtmqcOocAAlfUQN3ETrJ8bPJ7uWv3KoxADcQA

    Steps to Reproduce

    Run the given reporduction link or check this code

    
    option = {
      series: [
        {
          type: 'treemap',
          data: [
            {
              name: 'nodeA',
              value: 10,
              children: [
                {
                  name: 'nodeAa',
                  value: 4
                },
                {
                  name: 'nodeAb',
                  value: 6
                }
              ]
            },
            {
              name: 'nodeB',
              value: 20,
              children: [
                {
                  name: 'nodeBa',
                  value: 20,
                  children: [
                    {
                      name: 'nodeBa1',
                      value: 20
                    }
                  ]
                }
              ]
            }
          ],
          label: {
            formatter: function () {
              return "{img|}"
            },
            rich: {
                img: {
                  backgroundColor: {
                    image: 'https://s3-symbol-logo.tradingview.com/reliance-industrial-infrastructure.svg',
                  },
                  height: 50,
                  width: 50,
                  borderRadius: 25
                }
              }
          }
        }
      ]
    };
    

    Current Behavior

    Currently when set borderRadius, it not doing anything when backgroundColor is image

    Expected Behavior

    Image should have border radius.

    Environment

    • OS:
    • Browser:
    • Framework:

    Any additional comments?

    No response

    you can use svg renderer for the chart and target the image you use in backgroundColor using CSS

    svg > g > image {
         clip-path: inset(0% round 50%);
    }
    
  15. modified the milestones: 6.0.0, 6.x on Jun 20, 2025
  16. egemon commented on Sep 15, 2025

    @egemon

    @mintdart thanks a lot!

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

Metadata

Metadata

Assignees

Labels

ennew-feature

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions