话不多说,直接贴配置~~
options = {
title: {
show: isEmpty, // 是否要展示“暂无数据”矢量图
text: ' {a|}', // 写入占位符a,以便后续填充内容
x: 'center',
y: 'center',
subtext: '暂无数据', // 子标题
itemGap: -10, // 设置主副标题间隔
textStyle: {
rich: {
a: {
height: 54, // 设置图片高度
width: 68, // 设置图片宽度
backgroundColor: {
// 引入图片,作为背景图,填写相对路径
image: require('../static/img/chart_empty.svg')
}
}
}
},
subtextStyle: {
// 配置副标题的文字样式
fontSize: 12,
color: 'rgba(0, 194, 255, 0.75)'
}
}
}
chart.setOption(options);
图片效果如下: