echarts icon indicating copy to clipboard operation
echarts copied to clipboard

Treemap rich label alignment issue in echarts 5

Open jimivdw opened this issue 4 years ago • 9 comments
trafficstars

Version

5.0.1

Steps to reproduce

  1. Open Treemap example (https://echarts.apache.org/examples/en/editor.html?c=treemap-disk)
  2. Add the following label configuration:
// option.series ...
                label: {
                    show: true,
                    formatter: (x) => `{blue|${x.name}}`,
                    rich: {
                        blue: {
                            color: "blue"
                        }
                    }
                }
// ...
  1. Notice labels are aligned in top left corner while they should be centered

What is expected?

Labels are centered (except when configured otherwise)

What is actually happening?

Labels are in top left corner

image


Running the exact same code in the treemap demo of echarts 4 (https://echarts.apache.org/v4/examples/en/editor.html?c=treemap-disk) does not have this issue.

image

Also, explicitly setting align: "center", verticalAlign: "middle" does not help; the label will get centered horizontally, but not vertically.

jimivdw avatar Jan 26 '21 17:01 jimivdw

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 question.

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

Have a nice day! 🍵

echarts-bot[bot] avatar Jan 26 '21 17:01 echarts-bot[bot]

Hi, this doesn't have nothing with this subject, but I need to ask something that I try to find solution on DOCS, on Stack, in PRs, and in Issues, and can not find, and I am not sure if that is for new feature or bug. Is there a way for treemap that have multilevels, to have SUM of all values for that level? ex. If I am on first leaf level, I need TOTAL SUM of all values from that level to show to user, when click on some child leaf, need to get TOTAL SUM of all values from that level etc... Thanks and sorry for interrupt.

MilosPopovic11 avatar Mar 04 '21 14:03 MilosPopovic11

Did you resolved the question? please...

89466598946659 avatar Mar 18 '21 12:03 89466598946659

Did you resolved the question? please...

vision-yip avatar Apr 20 '22 08:04 vision-yip

Hello sorry to ask but did you find any solutions ?

GillianEgg avatar Nov 07 '22 10:11 GillianEgg

您的邮件已收到!O(∩_∩)O!--------Pan

89466598946659 avatar Nov 07 '22 10:11 89466598946659

Unfortunately no.

On Mon, Nov 7, 2022 at 2:07 AM EggerickxGillian @.***> wrote:

Hello sorry to ask but did you find any solutions ?

— Reply to this email directly, view it on GitHub https://github.com/apache/echarts/issues/14128#issuecomment-1305375994, or unsubscribe https://github.com/notifications/unsubscribe-auth/APMTZTNTOBXJPIVUY4XEOCDWHDIHBANCNFSM4WT2IHKQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- ~Nick True

nick-true-dev avatar Nov 07 '22 20:11 nick-true-dev

Solution👇

{
  label: {
    position: 'inside',
    rich: {
      blue: {
        color: 'blue',
        align: 'center'
      }
    }
  },
  labelLayout: (params) => { return { y: params.labelRect.y, align: 'center', } },
}

wengcd avatar Dec 12 '24 00:12 wengcd

您的邮件已收到!O(∩_∩)O!--------Pan

89466598946659 avatar Dec 12 '24 00:12 89466598946659