96编辑器旗下产品
找图
终身
ID:0
到期时间:永久
退出登录
您的位置:首页 > 百科管理 > 详情

echarts折线图tooltip formatter-echarts tooltip 自定义formatter怎么设置颜色

原创:找图网 2023-04-30 06:49:06
  • echarts自定义tooltip显示内容

  • echarts 中自定义 tooltip 的属性是 formatter ,它是一个方法,主要是讲一下怎么将自定义的值显示在 tooltip 中,因为自己刚开始用的时候,还是查了半天的。

    当未定义的时候,数据如下:

    tooltip 显示如下:

    当 hover 最后一条数据的时候,输出如下:

    此时再次 hover 的时候,显示就变为

  • echarts tooltip 自定义formatter怎么设置颜色

  • 官方文档里面好像没有这个API

    默认的tooltip不是canvas而是div;

    所以直接在formatter里面添加span设置好颜色就可以了

    tooltip: {

    trigger: 'axis',

    formatter: '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:#ff6f0b"></span>

    }

  • echarts tooltip 自定义formatter怎么设置颜色

  • 直接在formatter里面添加span设置好颜色就可以了

    tooltip: {

    trigger: 'axis',

    formatter: '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:#ff6f0b"></span>本房价: {c0}万'

    }

    最新文章 更多
    最新素材 更多
    公司介绍 网站地图 图片资讯
    Copyright © 2010-2022 山东找图网络科技有限公司  鲁ICP备18007836号-3  邮箱:15653358549@163.com