You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "Recursing (via GitHub)" <gi...@apache.org> on 2024/01/01 18:03:38 UTC

[I] [Bug] Label overflow gets ignored in bar chart [echarts]

Recursing opened a new issue, #19456:
URL: https://github.com/apache/echarts/issues/19456

   ### Version
   
   5.4.3
   
   ### Link to Minimal Reproduction
   
   https://echarts.apache.org/examples/en/editor.html?c=bar-negative2&lang=ts&code=PYBwLglsB2AEC8sDeAoWtJgDYFMBcya6GOAHmAQOQBCAhgE6wDCAFg2LAO4RguxYwA5v1oAjHFgDOlIgF8ANEUH0IAEwJJYAYxhhaEaABkxEgmHoBXHLAVEwwYFkggNRdOYiDBOelVqkIaUViWH9AgAVgAzAfVxD3AE8QfFhKSTZVYE4ZENk5YNhSAEEAyTjiMCSUygA3WiwrSgL0EGBJHihoKnsQJrdYSRAsHkMDFNR4_jGAZUrccsnK5KpVWnScVRz4vNzm0NLjcSwF4gAzYHoAW1owGN9YAAo6hpToC0vxegBKBAA-fpC0BwnFgAEloNgAHQAOXenwAYhdrmAHhZoKocKcxqp5IRJiFJHNqloLPR6DhoFoEn18cQSWSKVSqEUAKoAERptNg1wCl3e8PotC0kBgbM8PDKsAADADiLIvpDzlcbk96lYvv0djYCgkSoETktiTccIILtS9mFJKMgRoBiwsgRTvVJNZbCFLYdTMg7Q7YE6pK6LaUACoQLQAa1t6V9_pd2v6g2GYGt4x9nEdzsD_VWegIAG1ZZRpsBLtYaj4ErBy_RK9XaxWqw2642ay3663m52m92Oz32_224Ou72RwPh2O-0PJ-Op6PZwOBNBhDFyJyQkWS2Xp9u5zO9zuJ7uD_OT4vl2QwGviBvSyf90eH4en3fj_eF0ISKu9ugb1vHy__zfADnyAmcz0_S9-gAXXyIgXRUHBJQLEIJniHQBHoagEhWG5aCvdB0IufNKAAYmoIoAEYAHYAFZqCaVIyKKAAmABOABmAAWBjSKYJhOIoiiaJ4ki2SKdiaJo5jKCg78MCqKhRAYfCRCOE4CXtdMMEsHA5PQJVkTuKgkFEWQVPQYBq1OAQtMoURyVocNzNgVp2hFLpUgMdoMWDUBDExSDJjdeIc1ofN
 mKlSLcU4yKpVxAAOWLcXYiLIpg3IiBg2QAG4gA&version=5.4.3
   
   ### Steps to Reproduce
   
   1. Create a chart with a series with `type: 'bar'`
   2. Add visible labels, with text long enough that it needs to break into multiple lines, at least on mobile
   3. Set `overflow: 'break'` so the label text will break into multiple lines
   
   
   ### Current Behavior
   
   Label text overflows despite setting `overflow: 'break'`
   ![image](https://github.com/apache/echarts/assets/6978200/9a8ca5e4-697c-4c14-ab26-f0b5be19f8d1)
   
   
   ### Expected Behavior
   
   Label text to break, like it does with other chart types. Something that would look like this:
   
   ![image](https://github.com/apache/echarts/assets/6978200/d88f0739-6204-487a-802e-7847eef66013)
   
   
   ### Environment
   
   ```markdown
   - Browser: Chrome 120
   ```
   
   
   ### Any additional comments?
   
   Any value of `overflow` gets ignored, not just `break` but also `truncate` and `breakAll`
   
   Thank you for offering this wonderful library. I hope I'm not misunderstanding the [documentation](https://echarts.apache.org/en/option.html#series-bar.label.overflow) as this seems to be supported.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [I] [Bug] Label overflow gets ignored in bar chart [echarts]

Posted by "gzamann (via GitHub)" <gi...@apache.org>.
gzamann commented on issue #19456:
URL: https://github.com/apache/echarts/issues/19456#issuecomment-5390677963

   @helgasoft it would require seeing the chart and hardcoding width for each series manually
   
   this is what worked for me
   ```
   labelLayout: (params) => {
                       const labelWidth =  params.labelRect.width
                       const barWidth =  params.rect.width
                       const hideLabel = labelWidth >= barWidth
                       if (hideLabel) return { width: 0 }
                       return {}
                   },
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [I] [Bug] Label overflow gets ignored in bar chart [echarts]

Posted by "helgasoft (via GitHub)" <gi...@apache.org>.
helgasoft commented on issue #19456:
URL: https://github.com/apache/echarts/issues/19456#issuecomment-5386621380

   @gzamann, to fit widths to individual bars, one could use [data.label.width](https://echarts.apache.org/en/option.html#series-bar.data.label.width)
   [Demo](https://echarts.apache.org/examples/en/editor.html?c=bar-negative2&lang=js&code=3VRLa9tAEL7nVwz0sAmYxLZsSlVS8INAwZRC0lPxYS2tpSWrXbEaxTbG_7370lpOk3MgOkijnW9mvnmtqpErCfdwvAJAjoKlTjQ_bI8pkDnVsCipRthxLEEoWYCgGyYaYmCngXkVmufGCjIlkXK5stoUULfM61EpgbyOjjUvCqaNb7rnDbEIACv-VlyiVXicQR5qQ4c0Jc3VzoYzAbug-5mxiC498IWKlgWHtWq4Tc0co6rDYVMLjisuY5IAwvw94uGcd89fTpuS5T6wDx2Ce74h0c5sq3RF0SVw7ZjcwP2P6FKyHfyUKG5_tdWG6QcHvm5lzraGQT7oRTc8PSGStVozmR0Cff90h0Y_-7O8UFWGVtVWD5pmNvclLziaIg0j5HRz62kGhpc1PbxR04wiK5TuKLi8fQGhKdUuhS0VTWj0ZVne0z_x7Pkddb8_b-lzijSFvyEd8qgqBi9MHz7Ny62X3bzY1g9L8jWVdTclDdOcmTHxbejGNlNC6bkdStukSN8dGyz5Mp-Nvk7nZABWHH9LJk5cLCaj0dSJy1kynY7JujMNA7ihOnpzF09_Uf2M2KvmvAa9PSTHzam3IMokthXWgmw0o889Ve-64LLhOXtS9YptMS5_B727C0OYjIfD4QBG9mNr8_98muK4LUsD1LM_7niOZZokySk6jUjn7RVyNBmekT6S3dj11en7Pw&version=5.4.3&enc=deflate)
   
   <img width="727" height="493" alt="Image" src="https://github.com/user-attachments/assets/b55666ae-3a81-412c-9866-79023f23de35" />


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [I] [Bug] Label overflow gets ignored in bar chart [echarts]

Posted by "Recursing (via GitHub)" <gi...@apache.org>.
Recursing closed issue #19456: [Bug] Label overflow gets ignored in bar chart
URL: https://github.com/apache/echarts/issues/19456


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [I] [Bug] Label overflow gets ignored in bar chart [echarts]

Posted by "helgasoft (via GitHub)" <gi...@apache.org>.
helgasoft commented on issue #19456:
URL: https://github.com/apache/echarts/issues/19456#issuecomment-1874487691

   overflow does not know where to break without _width_. Add [label.width](https://echarts.apache.org/en/option.html#series-bar.label.width).
   📌 please close issue if problem solved.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [I] [Bug] Label overflow gets ignored in bar chart [echarts]

Posted by "gzamann (via GitHub)" <gi...@apache.org>.
gzamann commented on issue #19456:
URL: https://github.com/apache/echarts/issues/19456#issuecomment-5365164303

   setting width does not solve this issue. `width` only works as a max-width.
   From the above image, what should be the width value to solve this? let's say we use 25, and it works fine for first 3 bars, but the last one has not enough space to render the set `width` itself and it'll overflow


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org