/**
     * tooltip配置项示例
     */
    tooltip: {
        trigger: 'item'
    },

默认提示框效果一:显示当前单个数据项的提示框

Echarts 的悬浮框tooltip显示自定义格式化

    /**
     * tooltip配置项示例
     */
    tooltip: {
        trigger: 'axis'
    },

默认提示框效果二:显示当前横坐标下多个数据项的提示框

Echarts 的悬浮框tooltip显示自定义格式化

   /**
     * tooltip配置项示例
     */
    //用formatter回调函数显示单项数据内容
    tooltip: {
        trigger: 'item',
        formatter: function (params) {
            var color = params.color;//图例颜色
            var htmlStr ='<div>';
            htmlStr += params.name + '<br/>';//x轴的名称
            
            //为了保证和原来的效果一样,这里自己实现了一个点的效果
            htmlStr += '<span style="margin-right:5px;display:inline-block;width:10px;height:10px;border-radius:5px;background-color:'+color+';"></span>';
            
            //添加一个汉字,这里你可以格式你的数字或者自定义文本内容
            htmlStr += params.seriesName + ':'+params.value + '笔';
            
            htmlStr += '</div>';
            
            return htmlStr; 
        }
    }

默认提示框效果三:显示当前单个数据项的自定义提示框

Echarts 的悬浮框tooltip显示自定义格式化

相关文章:

  • 2021-12-09
  • 2021-06-09
  • 2021-07-25
  • 2022-12-23
  • 2021-12-21
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2022-01-15
  • 2022-12-23
相关资源
相似解决方案