Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.6k views
in Technique[技术] by (71.8m points)

echarts3 树图文字遮挡 重叠

image.png
chearts版本:3.8.5
配置如下
期望文字不重叠,节点距离大一些

series: [
        {
          type: "tree",
          data,
          rootLocation: { x: "right", y: "10%" },
          symbolSize: 7,
          label: {
            normal: {
              position: "left",
              verticalAlign: "middle",
              align: "right",
              fontSize: 15,
            },
            emphasis: {
              fontSize: 25,
            },
          },
          leaves: {
            label: {
              normal: {
                position: "right",
                verticalAlign: "middle",
                align: "left",
              },
            },
          },
          expandAndCollapse: true,
          animationDuration: 550,
          animationDurationUpdate: 750,
        },
      ]

求路过大神指导


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

这个没有办法处理,就是更高版本的echearts也没有处理好,唯一的办法是减小fontSize的值,或者人为设置echearts实例显示区域(渲染容器)的尺寸到足够大。
因为echearts默认是只在一个确定的显示区域中进行布局,如果字体尺寸过大(列出的项又特别多),则肯定存在重叠的情况。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...