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.

Community
  • 1
  • 1
George
  • 1,036
  • 2
  • 11
  • 23

1 Answers1

0

The attributes of the series are stored in e.series

In my case having passed a total variable into the Json I've modified multiBarHorizontalChart.js so that the function now looks like:

tooltip = function(key, x, y, e, graph) {
    return '<h3>' + key + ' - ' + x + '</h3>' +
           '<p>' +  y + '/' + e.series.total + '</p>'
  }
George
  • 1,036
  • 2
  • 11
  • 23