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

Legend text is not correctly aligned with icon (solution) #2983

Closed
jeffrey-roosendaal opened this issue Apr 12, 2016 · 10 comments
Closed

Legend text is not correctly aligned with icon (solution) #2983

jeffrey-roosendaal opened this issue Apr 12, 2016 · 10 comments
Milestone

Comments

@jeffrey-roosendaal
Copy link

I noticed that the text align in the legend is not correct. It happens with every symbol type. See screenshots below.

wrong-circle

wrong-square

This happens both on your website (http://echarts.baidu.com/demo.html#area-stack) as well as on my website.


I've updated line 41766 in echarts.js (3.1.6, not minimized) to:

y: (itemHeight / 2) - 6 (I've added the - 6 as a correction).

Now, they're perfectly aligned:

correct-circle

correct-square


Greetings from an international user!

@pissang
Copy link
Contributor

pissang commented Apr 13, 2016

Hi Jeffrey, can you give us the fontFamily in your case. We noticed that it has the same problem when using Microsoft Yahei.

@jeffrey-roosendaal
Copy link
Author

I'm using Open Sans through Google Fonts.

Maybe the best solution here would be to add a legend.textStyle.lineHeight option. So people can adjust the vertical text alignment for other/custom fonts too.

@pissang
Copy link
Contributor

pissang commented Apr 13, 2016

It seems helpful. Considering adding it in the next release

@pissang pissang added this to the 3.1.7 milestone Apr 16, 2016
@pissang pissang modified the milestones: 3.1.8, 3.1.7 Apr 21, 2016
@pissang pissang modified the milestones: 3.1.9, 3.1.8 May 12, 2016
@pissang
Copy link
Contributor

pissang commented May 16, 2016

Vertical align has been fixed in ecomfe/zrender@65097a1. Tried Open Sans and it seems align problem not exists anymore.

@pissang pissang closed this as completed May 16, 2016
@kkkisme
Copy link

kkkisme commented Oct 29, 2021

5.2.1 存在同样问题,并且使用legend.textStyle. padding 控制不起作用
legend: {
icon: "rect",
itemWidth: 12,
itemHeight: 12,

}

image

@Turing97
Copy link

5.2.1 存在同样问题,并且使用legend.textStyle. padding 控制不起作用 legend: { icon: "rect", itemWidth: 12, itemHeight: 12,

}

image

版本5.2.2 我也遇到了,用svg渲染就正常了,奇怪

@Raphyyy
Copy link

Raphyyy commented Jan 24, 2022

image

I can't find a way to correctly align the legend text with Roboto font (Echarts 5.2.2 used)
Setting legend.textStyle.lineHeight doesn't change a thing

@francisco-polaco
Copy link

image

I can't find a way to correctly align the legend text with Roboto font (Echarts 5.2.2 used) Setting legend.textStyle.lineHeight doesn't change a thing

Hey there!
Did you find a way to workaround this?

@Raphyyy
Copy link

Raphyyy commented Jul 12, 2023

Hey! unfortunately no I am still having this issue.

@nguyenvu9405
Copy link

I am still having the issue. I'm using v5.4.2.

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

No branches or pull requests

7 participants