2017-07-03 112 views

回答

1

这可以通过配置tooltip.format.title来完成:

tooltip: { 
     format: { 
     title: function (index) { 
      return totals[index] 
     } 

tooltip.format.value

 value: function (value, ratio, id, index) { 
      return d3.format("%")(value/totals[index]) 
     } 
    } 
    } 

正如你可以在上面看到,你需要计算合计值的数据组的

var totals = [390, 500, 500, 900, 550, 550] 

example