我有一张nvd3饼图。我正在获取百分比值作为标签,但我希望它在工具提示中。下面是HTML:如何获取nvd3饼图工具提示中的百分比?
<nvd3-pie-chart data="Data1"id="labelTypePercentExample"
width="550"
height="350"
x="xFunction()"
y="yFunction()"
showLabels="true"
pieLabelsOutside="false"
tooltips="true"
tooltipcontent="toolTipContentFunction()"
labelType="percent"
showLegend="true">
</nvd3-pie-chart>
DATA
Data1=[{ key: "Ongoing", y: 20 },
{ key: "completed", y: 0 }];
这里是表示密钥作为工具提示数据工具提示功能。
$scope.toolTipContentFunction = function(){
return function(key, x, y, e, graph) {
return '<h1>' + key + '</h1>'
}
}
请您详细说明您的答案,并在上面提供您所提供的解决方案的更多描述。 – abarisone