0

I'm using an NVD3 multiBarHorizontalChart to display some stacked data. Each series is a type of record and then the values are the number of records which meet a certain criteria.

I would like to modify the tooltip so that the value shows how many met the criteria out of the total number of records that type so "33 / 100" rather than "33" as now.

I've seen nvd3 piechart.js - How to edit the tooltip? and have added the value to the json I'm passing to the datum parameter but I'm not sure how to reference that in the function.

4

1 回答 1

0

系列的属性存储在 e.series

在我将总变量传递给 Json 的情况下,我修改了 multiBarHorizo​​ntalChart.js 以便函数现在看起来像:

tooltip = function(key, x, y, e, graph) {
    return '<h3>' + key + ' - ' + x + '</h3>' +
           '<p>' +  y + '/' + e.series.total + '</p>'
  }
于 2013-11-15T12:40:54.193 回答