highcharts和sankey图中的不同节点工具提示

highcharts和sankey图中的不同节点工具提示,highcharts,sankey-diagram,Highcharts,Sankey Diagram,在Highcharts-sankey图中,我想用工具提示标记节点。左侧(发送方节点)的标签应与右侧(接收方节点)的标签不同 示例: 左节点:“CVP(原始党投票):6000” 右节点:“CVP(接收方投票):5000” 我尝试使用nodeFormatter格式化函数,但失败了。 JSFIDLE在这里: 您可以使用列来标识左侧和右侧节点(): 如果将console.log(this)作为nodeFormatter函数的第一行,则可以查看节点上的可用属性 tooltip: { nodeFor

在Highcharts-sankey图中,我想用工具提示标记节点。左侧(发送方节点)的标签应与右侧(接收方节点)的标签不同

示例:
左节点:“CVP(原始党投票):6000”
右节点:“CVP(接收方投票):5000”

我尝试使用nodeFormatter格式化函数,但失败了。 JSFIDLE在这里:


您可以使用
来标识左侧和右侧节点():

如果将
console.log(this)
作为
nodeFormatter
函数的第一行,则可以查看节点上的可用属性

tooltip: {
    nodeFormatter: 
        function() {          
             if (this.point.fromNode.name != null) {
                 return (point.name +'(Origin Party Votes): '+point.sum);
             }      
             else if (this.point.toNode.name != null) {
                 return (point.name +'(Receiver Party Votes): '+point.sum);
             };
        }              
}
tooltip: {
  nodeFormatter: function() {
    if (this.column === 0) {
      return (this.name + ' (Origin Party Votes): ' + this.sum);
    } else if (this.column === 1) {
      return (this.name + ' (Receiver Party Votes): ' + this.sum);
    }
  }
}