amcharts4 icon indicating copy to clipboard operation
amcharts4 copied to clipboard

Weird boxing size for label

Open acivita opened this issue 1 year ago • 4 comments

hello :).

I hope you are all doing fine.

I am trying to use label.html to get a custom label.

I have an issue about the width of the container (is not 100%, its less or more).

To check if the container was the problem, i put some red background. capture stack overflow

On this example, the text is not properly center because horizontalCenter is based on the container and not the actual width.

I tried to reproduce the code in codepen, but this problems doesn't seem to happen (I can't see the red background).

Both code are identicals.

There is my code pen : https://codepen.io/acivita/pen/vYRmzgO

Verticaly align my items is not working as well but i try to understand the first issue.

Thank you for your help

acivita avatar Aug 17 '22 12:08 acivita

So i tried a few things with codepen :

First, i make a html/css who is exactly what i would like : https://codepen.io/acivita/pen/BarvPzZ

Then i tried to used it with amcharts, works good but its too big : https://codepen.io/acivita/pen/KKobeXm

Finally i tried to set smaller values, but i have the same issue : https://codepen.io/acivita/pen/vYRmzgO

It seems it had difficulties with very small properties, i haven't got a clue how to solve it.

Thank for the help and have a nice day.

acivita avatar Aug 18 '22 13:08 acivita

Your second CodePen looks good, except the label gets zoomed in together with the map.

You can just disable the scaling:

label.nonScaling = true;

martynasma avatar Aug 25 '22 10:08 martynasma

Hello, how are you ?

Thank you for your answer.

I've already tried the nonScaling property, it works good but as it doesn't scale if I zoom out, it keeps the same size. then its too big.

For example ; https://codepen.io/acivita/pen/KKobeXm

I set the good size at a zoom level of 15, but if the zoom changes it doesn't scale (normal because of nonScaling) and ruins my map because of the cities orverlap.

I really want something that doesn't scale with a very small size where properties like horizontal center works.

I may try to hide them at the a certain zoomLevel but i'm not sure it's possible (but i found it a bit ugly).

Thank for your help and have a nice day.

acivita avatar Aug 30 '22 12:08 acivita

Well, if you need the label to scale with zoom, but not be too big initially, you can set its scale setting:

label.scale = 0.1;

martynasma avatar Aug 30 '22 13:08 martynasma

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Sep 30 '22 00:09 github-actions[bot]