答案 0 :(得分:1)
这可以通过配置tooltip.format.title:
来完成 tooltip: {
format: {
title: function (index) {
return totals[index]
}
value: function (value, ratio, id, index) {
return d3.format("%")(value / totals[index])
}
}
}
正如您在上面所看到的,您需要计算数据组的总值:
var totals = [390, 500, 500, 900, 550, 550]
请参阅example 。