如何使用带 AngularJS 的 n3-charts 在工具提示中显示字符串数据

How to show string data in tooltip using n3-charts with AngularJS

我需要使用 n3-charts 在我的图表中显示一些文本数据。 例如,这是我的数据对象:

[{x: new Date(X,X,X), stopNum:stopNumber, stopsName:stopName, edge:tolerance, satsView:satsVal, satsUse:satsUseVal},
{x: new Date(X,X,X), stopNum:stopNumber, stopsName:stopName, edge:tolerance, satsView:satsVal, satsUse:satsUseVal},
{x: new Date(X,X,X), stopNum:stopNumber, stopsName:stopName, edge:tolerance, satsView:satsVal, satsUse:satsUseVal}]

我需要的是在鼠标悬停后显示的工具提示中显示公交车站的名称。

我尝试使用工具提示格式化程序、tooltipHook 和其他一些选项,但没有任何效果。 你能给我推荐一些可以帮助我解决这个问题的东西吗?

非常感谢!

您可以使用 tooltipHook 调整工具提示格式及其内容

tooltipHook: function(d){
  if (d) {
    return {
      rows:  d.map(function(s){
      })
    }
  }
}