echarts自定义tooltip显示内容

echarts自定义tooltip显示内容

     tooltip: {
          trigger: "axis",

          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;9px;height:9px;background-color:' +
                item.color +
                '"></span>';
              result += item.seriesName + ":";
              result += isNaN(item.value) ? 0 : item.value;
            });
            return result;
          },
        },

修改前:
avater

修改后:
avater

原文地址:https://www.cnblogs.com/DZzzz/p/15169745.html