echarts自定义tooltip显示内容

formatter : function(params) {
    var result = params[0].name;
    params.forEach(function(item) {
        result += '<br/>';
        result += '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:' + item.color + '"></span>';
        result += item.seriesName + ":";
        result += isNaN(item.value) ? 0 : item.value;
    });
    return result;
}

显示效果

猜你喜欢

转载自my.oschina.net/u/2968713/blog/878928