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

});

});

相关推荐
用户新3 小时前
V8引擎 精品漫游指南--Ignition篇(下 一) 动态执行前的事情
前端·javascript
@PHARAOH5 小时前
WHAT - GitLens vs Fork
前端
yqcoder5 小时前
前端性能优化:如何减少重绘与重排?
前端·性能优化
洋子6 小时前
Yank Note 系列 13 - 让 AI Agent 进入笔记工作流
前端·人工智能
wenzhangli78 小时前
Ooder A2UI 核心架构深度解析:WEB 拦截层的设计与实现
前端·架构
前端百草阁8 小时前
【前端性能优化全链路指南】从开发编写到构建运行的多维度实践
前端·性能优化
神探小白牙9 小时前
eCharts 多系列柱状图增加背景图
javascript·ecmascript·echarts
女生也可以敲代码9 小时前
AI时代下的50道前端开发面试题:从基础到大模型应用
前端·面试
ZhengEnCi9 小时前
M5-markconv自定义CSS样式指南 📝
前端·css·python
IT_陈寒9 小时前
SpringBoot自动配置的坑差点让我加班到天亮
前端·人工智能·后端