echarts icon indicating copy to clipboard operation
echarts copied to clipboard

visualMap labels misaligned

Open jimivdw opened this issue 5 years ago • 7 comments

Version

4.8.0

Steps to reproduce

  1. Go to https://echarts.apache.org/examples/en/editor.html?c=heatmap-large-piecewise
  2. Set option.visualMap.textStyle to {fontWeight: "lighter"}
  3. (optional, to emphasise the issue): set option.textGap to -10

What is expected?

Label is aligned in vertical middle of the item icon

What is actually happening?

Label is aligned higher (at top?)

image vs. image


The actual issue I'm having is not with using a different font weight, but rather with a different font family that happens to have a different default height. I did find out however that the issue also occurs with the "lighter" font weight of the default font, which was easier to reproduce.

Setting a different value for lineHeight has no effect (could be that that is in fact the problem).

I'd also be fine with having an option to explicitly set the padding of the text label (in the textStyle), like you can already do for the legend.

jimivdw avatar Aug 11 '20 08:08 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 questions.

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

Have a nice day! 🍵

echarts-bot[bot] avatar Aug 11 '20 08:08 echarts-bot[bot]

This is probably caused by font baseline position of different font weight on different platforms. For example, I cannot reproduce it on Mac.

There's nothing really we can do about this. Perhaps you can try with another font.

Ovilia avatar Aug 11 '20 09:08 Ovilia

Hi @Ovilia , thanks for your quick reply.

Strange that you cannot reproduce it, I'm also on Mac myself (Mojave 10.14.6).

Also, why is there nothing you can do about this? There should be some way to compensate for different baseline positions of different fonts. Maybe not automatically, but setting a different lineHeight or manually specifying some top padding should be able to do the trick imho.

jimivdw avatar Aug 11 '20 10:08 jimivdw

@jimivdw Would it help if we could provide something like offsetX and offsetY to adjust text position?

Ovilia avatar Aug 12 '20 04:08 Ovilia

Yes, that would help 😊

jimivdw avatar Aug 12 '20 05:08 jimivdw

@jimivdw Would it help if we could provide something like offsetX and offsetY to adjust text position?

Is there any news on this? Looking over the docs I guess piece label can not be customized? https://echarts.apache.org/en/option.html#visualMap-piecewise.pieces

Nurech avatar Feb 16 '22 03:02 Nurech

This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.

github-actions[bot] avatar Feb 16 '24 21:02 github-actions[bot]

This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!

github-actions[bot] avatar Feb 23 '24 21:02 github-actions[bot]