echarts icon indicating copy to clipboard operation
echarts copied to clipboard

axis name and label overlaps when the nameLocation is 'center' or 'middle'

Open ihakh opened this issue 5 years ago • 13 comments

Version

4.7.0

Steps to reproduce

in this example https://echarts.apache.org/examples/en/editor.html?c=watermark add these lines to yAxis:

        name:'some longe name',
        nameLocation:'center',

image

What is expected?

the name comes after the longest label name automatically

What is actually happening?

the name and label overlaps


we can fix it by nameGap for a certain resolution but it is not dynamic and on different resolution the it may be wrong besides when using a dynamic charts when the label length is unknown we can not be sure how much nameGap we must consider

ihakh avatar Apr 11 '20 05:04 ihakh

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

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

Have a nice day! 🍵

echarts-bot[bot] avatar Apr 11 '20 05:04 echarts-bot[bot]

This configuration item should be enhanced. Maybe you can use nameGap temporarily.

yufeng04 avatar Apr 13 '20 14:04 yufeng04

I have the same issue, waiting for an option like grid.containLabel.

tsanie avatar Jun 22 '20 07:06 tsanie

i have same issue, i think if nameLocation: middle, it should automatically calculate axis longest label and place name accordingly

ArturMiszkowicz avatar Sep 15 '20 12:09 ArturMiszkowicz

Same here. Any development? That renders terribly, and calculating manually nameGap is quite error-prone. image

locinus avatar Mar 24 '22 17:03 locinus

Having the same issue, wondering if there is an enhancement in progress?

Screen Shot 2022-04-14 at 3 21 26 PM

c3-anerishah avatar Apr 14 '22 22:04 c3-anerishah

Worth noting @rephus's workaround (for those waiting for this to be implemented in ECharts): https://github.com/lightdash/lightdash/pull/2730 :blush:

Peque avatar Dec 04 '22 22:12 Peque

两年了咋没进展呢, 我还以为是我没找到配置, 原来确实没有自动计算标题位置. 这可就难受了,如果每个chart都需要手动给个nameGap, 那得多难受!

benliu723 avatar Jan 13 '23 03:01 benliu723

两年了咋没进展呢, 我还以为是我没找到配置, 原来确实没有自动计算标题位置. 这可就难受了,如果每个chart都需要手动给个nameGap, 那得多难受!

不止两年了,16年就有兄弟提了

wozien avatar Feb 16 '23 08:02 wozien

The nameGap is not a good workaround because it can cause the axis name to shift left and right during data zooming, and it may still overlap with the axis labels. A better approach is to avoid using the axis-related name configuration and instead use the graphic component (in combination with grid.containLabel, which works well). For the y-axis:

{
  type: "text",
  left: 10,
  top: "center",
  rotation: Math.PI / 2,
  style: { text: "Y axis" }
}

For x-axis:

{
  type: "text",
  left: "center",
  bottom: "50", // in my case
  rotation: Math.PI / 2,
  style: { text: "X axis" }
}

You will get something like this: image

JunYang-tes avatar Aug 13 '24 02:08 JunYang-tes

This five year old issue is still there. Any progress or updates?

nick-delirium avatar Aug 12 '25 09:08 nick-delirium

works for me now with the new outerBoundsMode and outerBoundsContain: axisLabel (instead of old containLabel which didn't help)

oberhamsi avatar Oct 24 '25 07:10 oberhamsi

This should work Image

codeusb avatar Nov 19 '25 02:11 codeusb