修改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, // 更新图表配置

});

});

相关推荐
Sokach3869 分钟前
vue3引入tailwindcss 4.1
前端·css
小奋斗18 分钟前
深入浅出:JavaScript中 三大异步编程方案以及应用
javascript·面试
云水边21 分钟前
vue模版中.gitignore和.prettierrc功能区分
前端
尝尝你的优乐美23 分钟前
封装那些Vue3.0中好用的指令
前端·javascript·vue.js
敲代码的彭于晏26 分钟前
localStorage 不够用?试试 IndexedDB !
前端·javascript·浏览器
chxii28 分钟前
5.4 4pnpm 使用介绍
前端·javascript·vue.js
好好好明天会更好36 分钟前
Vue 中 slot 的常用场景有哪些
前端·vue.js
奔赴_向往1 小时前
【qiankun 踩坑】路由切换回来,子应用 Vuex Store 数据居然还在
前端
米开朗积德1 小时前
项目多文件JSON数值比对
javascript
sorryhc1 小时前
【AI解读源码系列】ant design mobile——Image图片
前端·javascript·react.js