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

});

});

相关推荐
-seventy-10 分钟前
对 JavaScript 原型的理解
javascript·原型
&白帝&27 分钟前
uniapp中使用picker-view选择时间
前端·uni-app
谢尔登34 分钟前
Babel
前端·react.js·node.js
ling1s34 分钟前
C#基础(13)结构体
前端·c#
卸任41 分钟前
使用高阶组件封装路由拦截逻辑
前端·react.js
lxcw1 小时前
npm ERR! code CERT_HAS_EXPIRED npm ERR! errno CERT_HAS_EXPIRED
前端·npm·node.js
秋沐1 小时前
vue中的slot插槽,彻底搞懂及使用
前端·javascript·vue.js
这个需求建议不做1 小时前
vue3打包配置 vite、router、nginx配置
前端·nginx·vue
QGC二次开发1 小时前
Vue3 : Pinia的性质与作用
前端·javascript·vue.js·typescript·前端框架·vue
云草桑1 小时前
逆向工程 反编译 C# net core
前端·c#·反编译·逆向工程