首页 前端知识 echarts tooltip文字太长换行

echarts tooltip文字太长换行

2024-04-29 11:04:30 前端知识 前端哥 795 531 我要收藏

tooltip文字太长换行,设置了宽度也没有换行,加上一句:
extraCssText: ‘max-width:300px; white-space:pre-wrap’,
没加之前是这样:
在这里插入图片描述

加上之后 extraCssText: ‘max-width:300px; white-space:pre-wrap’,

tooltip: {
trigger: "item",
extraCssText: 'max-width:300px; white-space:pre-wrap',
formatter: function (params) {
return ` ${params.seriesName}
<div style="display: flex;align-items: center;justify-content: space-between;margin-top:-15px;">
<span>${params.marker} ${params.name}</span>
<b style="flex:1;margin-left:10px;">${params.value}${params.percent}%</b>
</div>`
}
},
复制

效果图:
在这里插入图片描述

转载请注明出处或者链接地址:https://www.qianduange.cn//article/6335.html
标签
评论
发布的文章

JQuery中的load()、$

2024-05-10 08:05:15

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!