2014-03-19 69 views
0

Im做一個columnrange highchart,我的JSON樣本數據如下:在highcharts提示設置附加信息

{ 
    "name": "PW (md.h24mi)", 
     "data": [ 
     [320, 320.06], 
     [319.05, 319.1], 
     [319.05, 319.1], 
     [319.05, 319.1], 
     [319.05, 319.1], 
     [319.05, 319.1], 
     [319.05, 319.1], 
     [319.05, 319.1], 
     [319.05, 319.1], 
     [319.05, 319.1], 
     [319.05, 319.1], 
     [320, 320.04] 
    ], 
     "PW": [ 
     ["PW0000025090"], 
     ["PW0000025158"], 
     ["PW0000025160"], 
     ["PW0000025171"], 
     ["PW0000025172"], 
     ["PW0000025161"], 
     ["PW0000025173"], 
     ["PW0000025159"], 
     ["PW0000025164"], 
     ["PW0000025170"], 
     ["PW0000024827"], 
     ["PW0000024461"] 
    ], 
     "GROUP": [ 
     ["IT"], 
     ["Sierra"], 
     ["Sierra"], 
     ["RF Engineers"], 
     ["RF Engineers"], 
     ["Sierra"], 
     ["RF Engineers"], 
     ["Sierra"], 
     ["RF Engineers"], 
     ["RF Engineers"], 
     ["Sierra"], 
     ["IP"] 
    ], 
     "worksum": [ 
     ["Call Back Assist (CBA) Modification"], 
     ["TMA Installation"], 
     ["TMA Installation"], 
     ["TMA Installation"], 
     ["TMA Installation"], 
     ["TMA Installation"], 
     ["TMA Installation"], 
     ["TMA Installation"], 
     ["TMA Installation"], 
     ["TMA Installation"], 
     ["TMA Installation"], 
     ["Upgrade Consumer Wimax Firewall Modules to R77.10"] 
    ] 
} 

我如何得到它顯示的「私服」和「worksum」的提示?我已經嘗試了下面的代碼,但nada。

tooltip: { 
      formatter: function() { 
    var point = this.points[0]; 
    return '<b>'+ point.x +'<br />' 
     +point.PW + '<br />' 
     +point.worksum + '<br />' 
     +'</b><br />Duration:'+ point.series.data[0].low +' - '+ point.series.data[0].high; 
}, 
shared: true 

      } 

回答

1

您已經設置了密碼和工作區序列,因此您可以通過point.series.options.PW/worksum訪問工具提示。然後你需要提取相應的值(使用this.x)。這就是全部:http://jsfiddle.net/HsWF2/119/

tooltip: { 
     formatter: function() { 
      var point = this.points[0], 
       series = point.series, 
       PW = series.options.PW[point.x], 
       worksum = series.options.worksum[point.x]; 
      return '<b>' + point.x + '<br />' + PW + '<br />' + worksum + '<br />' + '</b><br />Duration:' + point.series.data[0].low + ' - ' + point.series.data[0].high; 
     }, 
     shared: true 

    }, 
+0

你是一個上帝!非常感謝!!!!!!!!!!!!! –