您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
在 ECharts 中,您可以通过配置 tooltip
属性来设置提示框的样式。以下是一个简单的示例,展示了如何自定义提示框的背景颜色、边框颜色、边框宽度、字体大小等样式:
var option = {
tooltip: {
trigger: 'axis',
backgroundColor: '#f5f5f5', // 提示框背景颜色
borderColor: '#333', // 提示框边框颜色
borderWidth: 1, // 提示框边框宽度
textStyle: { // 提示框内的文本样式
fontSize: 14, // 字体大小
fontWeight: 'bold' // 字体加粗
},
padding: [10, 15], // 提示框内边距
formatter: function (params) {
var html = '';
params.forEach(function (item) {
html += '<div style="color:' + item.color + '">' + item.seriesName + ': ' + item.value + '</div>';
});
return html;
}
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
name: 'Sales',
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: 'bar'
}]
};
echarts.init(document.getElementById('main')).setOption(option);
在这个示例中,我们设置了提示框的背景颜色、边框颜色、边框宽度、字体大小等样式。同时,我们还自定义了提示框内的文本样式,以及提示框的内边距。最后,我们使用 formatter
函数来自定义提示框显示的内容。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。