修改Echarts图表的标题和副标题的内容

直接上代码

var graphicConfig = [

{

type: "text",

left: "center",

top: "center",

style: {

text: "包日", // 初始化为空字符串

textAlign: "center",

fill: "#000",

fontSize: 14,

fontWeight: "bold",

},

id: "centerText", // 使用 id 标识这个元素,方便后续更新内容

},

];

var myChart = echarts.init(document.getElementById("userTypelistChat"));

myChart.setOption({

graphic: graphicConfig, // 初始化的 graphic 配置

});

myChart.on("mouseover", (params) => {

_this.name = params.name;

graphicConfig[0].style.text = _this.name; // 更新文本内容

myChart.setOption({

graphic: graphicConfig, // 更新图表配置

});

});

相关推荐
前端 贾公子2 分钟前
vue移动端适配方案 === postcss-px-to-viewport
前端·javascript·html
GISer_Jing1 小时前
AI营销增长:4大核心能力+前端落地指南
前端·javascript·人工智能
明远湖之鱼2 小时前
一种基于 Service Worker 的渐进式渲染方案的基本原理
前端
前端小端长2 小时前
Vue 中 keep-alive 组件的原理与实践详解
前端·vue.js·spring
FeelTouch Labs2 小时前
Nginx核心架构设计
运维·前端·nginx
雪球工程师团队3 小时前
别再“苦力”写后台,Spec Coding “跑” 起来
前端·ai编程
m0_471199633 小时前
【场景】前端怎么解决离线收银、数据同步异常等场景问题
前端·javascript
Curvatureflight3 小时前
前端性能优化实战:从3秒到300ms的加载速度提升
前端·人工智能·性能优化
用户99045017780093 小时前
ruoyi集成dmn规则引擎
前端