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] VerticalAlign middle not working #20131

Open
princ09 opened this issue Jul 8, 2024 · 3 comments
Open

[Bug] VerticalAlign middle not working #20131

princ09 opened this issue Jul 8, 2024 · 3 comments
Labels
bug en This issue is in English pending We are not sure about whether this is a bug/new feature. topic: label topic: treemap

Comments

@princ09
Copy link

princ09 commented Jul 8, 2024

Version

5.5

Link to Minimal Reproduction

https://echarts.apache.org/examples/en/editor.html?c=treemap-simple&code=PYBwLglsB2AEC8sDeAoWsDOBTAThLGAXLANprrLkWxgCeIWxA5GDllgLYCGITANFQoATLmC7Ey1aqilToXDo1hNowIVgCC_QbIBuXADYBXJQEYADANnUAxgAsIBoW2gSd1mddnzFzVeo0ubS89QxNiABZ3WQBfKxD0TwT0HyUVNU0AI2Dk9H1jJQA2aKkYkvQAXRK4kqTrVL8MgCEcr3zw2AAmS3LYe0dnLFdSXsTRigblfywmoPjc9qVu-eT-pxc3XOlx7wU06dnTVq28sKXzHYoyk6rc65Db63vqCpX0Ay5MrANiOuoAM2AOG4YDAuGI_yM0BskBgsAAFABKSgJNhgIw4OAAAyQEA4AHMAD4xWCXaSpQkAJQAogAZACSGgAcgBhakkskUJD_CA4DBgABqZ0JAGY-N1TAA6AAc5g5J2k2BsMCEQoKhPMkoA7FqAKQxLHjGpePD2X7jPH480nTJcGwAa3xOGAUKELOABiB1oVeK4-LSdlBICIAHoQxgRQBaDC0DiZD2Rz344CS1hcIQQaD43T4ADukuVHBDbAMEC40KwkczQiM_Lwhir0H-OC4daMMIxWElGF0-OOCWNWzsWAg-MDxAsPROuYgQjAdgn5inW3jOHUOEp6YgteIAFZl7lDKPhkwbEMwTh-yFdLhIDZDBpS_jhgAiDizoQGLAvo1vep7b1DyfE8z2gC8ry8QEwIAZQgAAvJYIj_LxlU9HBmAAYgAMRwiDrDBAAPMAABUW2gDBAWBZgjBABgcHvbAmF_cYeT5QUzkA5Ij2fZhQPA5DrCgsBYIQ4hlkuVCvXQJhsNwgTZEIkiyIooEOGo2jcAYrAmLueSKCVFU1Q6P4Qm4kDz1wPDZCEkSzGlPTbA9KSZJwrCrKkRTSPLFSqOUGi6K0nTkkHLwQusMzeIsy89JvHA7wfYDiDfD8vx_WJBHuKoYgAbiAA

Steps to Reproduce

Run the provided link or
below 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|} 
                  {name|RELIANCE} 
                  {firstValue|3,201.80} 
                  {secondValue|0.77%}`
            },
        rich: {
            img: {
              backgroundColor: {
                image: 'https://s3-symbol-logo.tradingview.com/reliance-industrial-infrastructure.svg',
              },
              height: 100,
              width: 100,
              borderRadius: 50,
              align: 'center',
              verticalAlign: "middle"
            },
            name: {
              align: 'center',
              fontSize: 24,
              color: '#FFF',
              textTransform: 'uppercase'
            },
            firstValue: {
              align: 'center',
              fontSize: 20,
              color:  '#FFF',
              textTransform: 'uppercase'
            },
            secondValue: {
              align: 'center',
              fontSize: 18,
              color: '#FFF',
              textTransform: 'uppercase'
            },
          },
          align: 'center',
          verticalAlign: "middle"
      }
    }
  ]
};

Current Behavior

When there are formatted label, align center and vericalAlign middle not working.

Expected Behavior

Expected all the formatted label with all element should be aligned center both verically and horizontally.

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

@princ09 princ09 added the bug label Jul 8, 2024
@echarts-bot echarts-bot bot added en This issue is in English pending We are not sure about whether this is a bug/new feature. labels Jul 8, 2024
@echarts-bot echarts-bot bot changed the title VerticalAlign middle not working [Bug] Jul 8, 2024
@helgasoft
Copy link

helgasoft commented Jul 8, 2024

keep in mind that all spaces and new-lines in formatter count. So instead of

        formatter: function () {
          return `{img|} 
                  {name|RELIANCE} 
                  {firstValue|3,201.80} 
                  {secondValue|0.77%}`
            },

we should write formatter: "{img|}\n{name|RELIANCE}\n{firstValue|3,201.80}\n{secondValue|0.77%}".
Also - arbitrary image URLs will not work inside the Editor, probably for security reasons.
Demo
📌 please close issue if problem solved.

@princ09
Copy link
Author

princ09 commented Jul 8, 2024

Hi @helgasoft
Thanks for your reply.
However, elements are still not vertically aligned in the middle.

Thanks for formatter tip btw.

@helgasoft
Copy link

oops, this issue is a duplicate of #19087

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug en This issue is in English pending We are not sure about whether this is a bug/new feature. topic: label topic: treemap
3 participants