惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
Spread Privacy
Spread Privacy
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
SecWiki News
SecWiki News
腾讯CDC
P
Privacy International News Feed
Webroot Blog
Webroot Blog
J
Java Code Geeks
爱范儿
爱范儿
A
About on SuperTechFans
S
Secure Thoughts
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
DataBreaches.Net
Cloudbric
Cloudbric
Security Archives - TechRepublic
Security Archives - TechRepublic
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Security Latest
Security Latest
Forbes - Security
Forbes - Security
小众软件
小众软件
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Threatpost
量子位
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Google Online Security Blog
Google Online Security Blog
云风的 BLOG
云风的 BLOG
GbyAI
GbyAI
S
Security @ Cisco Blogs
T
The Exploit Database - CXSecurity.com
Help Net Security
Help Net Security
V
Visual Studio Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 聂微东
P
Proofpoint News Feed
C
CERT Recently Published Vulnerability Notes
Attack and Defense Labs
Attack and Defense Labs

博客园 - 微宇宙

js-金额相加 小程序- 字符数据换行 antd-输入框去掉光晕 大屏缩放布局 大屏显示 echarts - 原型的方向盘动画 小程序- 自定义导航栏组件封装 小程序-echart动画git仓库 小程序- 隐私协议完善 小程序- 日期picker样式问题 echart - 折线图显示设置 echart - 移动端提示内容无阴影 echart 柱状图 - 零界点 正负方向展示 小程序 - 导航栏 图标设置 小程序 - 错误问题记录 react项目全屏功能 react-大屏显示antd浮窗 React andt库设置主题色彩 React闭包陷阱 git 操作 小程序 - 订阅消息通知 小程序-分包 mysql安装使用 redis安装使用 小程序-模板用法 小程序-登录验证码的加载方式 工作代码规范 小程序-锚链接 小程序-菜单tabbar设置 小程序-分享功能 小程序-树形结构 array数组 js 小程序-标题自定义设置 小程序-图表 小程序-拨打电话
echart 格式化水平坐标 tooltip数据
微宇宙 · 2026-01-21 · via 博客园 - 微宇宙

在做图表的时候,总是会遇到提示的内容和水平的内容格式不统一。然后每次都要做两次处理,鼠标滑过的提示x坐标内容 和 水平x显示的刻度要不一样,或者把外部的数据传入到内部进行切割。

更好的做法,提示的显示全部,水平的刻度单独做处理。

xAxis: [
    { 
      type: "category", 
      axisLabel: { 
          formatter: (value) => {
            const val = value?.split(' ')[1]?.split(':')[0] // 2026-1-20 20:00
          return val
        }
      },
      axisTick: { show: false }, data: [] 
    }
  ],

// 提示内容 - 适合小程序的配置样式

tooltip: {

    trigger: "axis",

    borderColor: '#eee', // 设置边框颜色为透明

    shadowOffsetX: 0, // 不使用水平偏移

    shadowOffsetY: 0, // 不使用垂直偏移

    valueFormatter,

    // position: ['30%', '30%'],

    textStyle:{

      fontSize: 11, // 设置字体大小

    textShadowColor:'transparent', // 阴影

    textShadowBlur:10

    }

  }

 

 移动端提示框内部 有阴影,去掉的方式设置 textShadowColor:'transparent'。

设置 坐标的数据最小值不为0,设置如下 yAxis: [{ type: "value", min: 'dataMin', max: 'dataMax', }], 防止有小数点,取证用这个方式 :yAxis: { type: "value", scale: true }。

设置多个Y坐标的方式如下: 在series设置 yAxisIndex: 1 ,要显示坐标的方式如下:axisLine: {show: true}, 

列表横坐标空数据,那就设置为空显示。

    const option = {
        title: {
          text: '暂无数据',
          x: 'center',
          y: 'center',
          textStyle: { fontSize: 16 }
        }
      };
      // 方法1:禁用合并(推荐)
      chart.setOption(option, true);

设置水平线的方式。

再一个series数据中某一个类型中设置如下的。

series: [
    {
          markLine: {
            data: [
              { yAxis:maxData, name: '最小值', lineStyle: { color: 'red', type: 'dashed' } }, // 最小值2,红色虚线
              { yAxis: minData, name: '最大值', lineStyle: { color: 'red' , type: 'dashed'} }
            ]
          }

    }
    
]