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

});

});

相关推荐
passerby606112 分钟前
完成前端时间处理的另一块版图
前端·github·web components
掘了20 分钟前
「2025 年终总结」在所有失去的人中,我最怀念我自己
前端·后端·年终总结
崔庆才丨静觅23 分钟前
实用免费的 Short URL 短链接 API 对接说明
前端
崔庆才丨静觅44 分钟前
5分钟快速搭建 AI 平台并用它赚钱!
前端
崔庆才丨静觅1 小时前
比官方便宜一半以上!Midjourney API 申请及使用
前端
Moment1 小时前
富文本编辑器在 AI 时代为什么这么受欢迎
前端·javascript·后端
崔庆才丨静觅1 小时前
刷屏全网的“nano-banana”API接入指南!0.1元/张量产高清创意图,开发者必藏
前端
剪刀石头布啊2 小时前
jwt介绍
前端
爱敲代码的小鱼2 小时前
AJAX(异步交互的技术来实现从服务端中获取数据):
前端·javascript·ajax
Cobyte2 小时前
AI全栈实战:使用 Python+LangChain+Vue3 构建一个 LLM 聊天应用
前端·后端·aigc