echarts图表无数据时,显示"暂无数据",富文本rich格式化title
效果图如下:
js代码
const echart = ecahrts.init(document.getElementById('myEcharts'));
const option = {
backgroundColor: '#ccc',
title: {
x: 'center',
y: 'center',
text: "这是普通的文本{a|暂}{b|无}{c|数}{d|据}",
textStyle: {
fontSize: 30,
color: "#333",
rich: {
a: {
color: 'red',
fontSize: 80,
fontWeight: 900,
},
b: {
color: 'yellow',
fontSize: 70,
fontWeight: 900,
},
c: {
color: 'blue',
fontSize: 60,
fontWeight: 900,
},
d: {
color: 'green',
fontSize: 50,
fontWeight: 900,
}
}
}
}
};
echart.clear();
echart.setOption(option, true);
来源:oschina
链接:https://my.oschina.net/qinghuo111/blog/4258374