echarts [Bug] When the bar chart label is too long, it will exceed the coordinate system range and cover the y-axis label

ia2d9nvy  于 5个月前  发布在  Echarts
关注(0)|答案(4)|浏览(196)

Version

5.5.0

click this

Steps to Reproduce

click this

Current Behavior

When the bar chart label is too long, it will exceed the coordinate system range and cover the y-axis label

Expected Behavior

The calculation of label position should take into account its length and always display it in the coordinate system

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

I tried to find the source code for label position calculation and made corrections, but I couldn't find it. Maybe someone can provide some ideas, thank you

zzoitvuj

zzoitvuj1#

have you tried a combination of label's overflow, width and lineHeight? They are designed to help with long labels.

pdsfdshx

pdsfdshx2#

have you tried a combination of label's overflow, width and lineHeight? They are designed to help with long labels.

In the case of dense x-axis, if overflow hiding is used, the number of displayed words will be too small

xxe27gdn

xxe27gdn3#

Have you tried customizing the line wrapping operation by setting label.formatter? '\n' can be used
The effect is as follows

ux6nzvsh

ux6nzvsh4#

labelLayout(params) {
        console.log(params) // learn more about the params here
        return {
          x: Math.max(45, params.labelRect.x),
          y: params.labelRect.y
        };
      }

相关问题