首页 > 解决方案 > 我如何在 highcharts 的工具提示中设置 xAxis 的实际值

问题描述

我得到xAxis标签的位置tooltip

在此处输入图像描述

xAxis我需要标签的实际值,tooltip即月份(Jan-20、Feb-20 等)。

这是我的代码:https ://jsfiddle.net/hze8r4go/10/ ,我做错了什么?

标签: highcharts

解决方案


而不是点格式化程序使用以下

formatter:function () {
        console.log(this);
          const template ="<span style='color:'"+this.points[0].color+"'>"+this.x+" : "+this.y+"</span>";
          console.log(template)
          return template;
        },

在上面的代码中使用并访问剩余值并构建所需的 HTML 模板并返回。


推荐阅读