本文主要是介绍修改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, // 更新图表配置
});
});
这篇关于修改Echarts图表的标题和副标题的内容的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!