【问题标题】:Higcharts: how to remove the styles of the tooltip container?Highcharts:如何删除工具提示容器的样式?
【发布时间】:2022-01-24 02:29:45
【问题描述】:

我有following jsFiddle,我试图将值(悬停点)移动到图表左上角的静态位置。

这是我的设置,与工具提示相关:

tooltip: {
  shared: true,
  borderRadius: 10,
  formatter: function () {
    return this.points.reduce(function (s, point) {
      let tooltipTxt = "";
      tooltipTxt += point.x + "<br/>";
      tooltipTxt += "Price: " + point.y + "<br/>";
      return tooltipTxt;
    }, this.x);
  },
  outside: true,
  borderWidth: 0,
  backgroundColor: 'transparent',
  shadow: false,
  style: {
    color: '#000'
  },
  useHTML: true,
  hideDelay: 3600000,
  positioner: function (labelWidth, labelHeight, point) {
    return {
        x: 30,
        y: 0
    };
 },
},

如何删除右上角框的样式并删除连接此框的线条与当前鼠标位置? 例如,我试图通过划掉我要删除的线条来说明这一点(另外,工具提示框的后绕线应该是透明的)

【问题讨论】:

    标签: highcharts


    【解决方案1】:

    你使用的是styled模式,所以需要通过CSS去掉边框:

    .highcharts-tooltip-box {
      stroke-width: 0;
    }
    

    现场演示: http://jsfiddle.net/BlackLabel/3L6t0d2e/

    API 参考: https://api.highcharts.com/highstock/chart.styledMode

    文档: https://www.highcharts.com/docs/chart-design-and-style/style-by-css

    【讨论】:

    • 如何将工具提示的背景颜色设置为透明?在检查元素时我找不到合适的类。您能否也更新一下您的答案?
    • 添加.highcharts-tooltip-box .highcharts-label-box { fill: transparent; } 也修复了背景颜色
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-04
    • 1970-01-01
    • 2022-07-14
    • 1970-01-01
    相关资源
    最近更新 更多