如何为 Highchart 中的散点图自定义工具提示样式?

How to customize tooltip styling in for Scatter plot in Highchart?

我需要自定义高图表工具提示的样式(背景颜色、边框等)。

我知道我可以这样设置工具栏:

scatter: {
  ...
  tooltip: {
      headerFormat: '...',
      pointFormat: '...',
  }

} 但我需要更多样式选项,如背景颜色等。出于某种原因,当我尝试像这样在常规工具提示中设置这些属性时它不起作用:

scatter: {
  ...
  tooltip: {
      headerFormat: '...',
      pointFormat: '...',
      backgroundColor: 'black',
  }

}

那么如何在 highschart 中制作带有散点图的自定义工具提示?

您需要在主级别定义工具提示选项:

Highcharts.chart('container', {
    ...,
    tooltip: {
        headerFormat: '...',
        pointFormat: '...',
        backgroundColor: 'black',
    }
});

现场演示: http://jsfiddle.net/BlackLabel/6gxcanhs/

API参考:https://api.highcharts.com/highcharts/tooltip