【发布时间】:2014-08-28 17:12:36
【问题描述】:
我有一个 nvd3 饼图。我正在获取百分比值作为标签,但我希望它在工具提示中。这是 HTML:
<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>
数据
Data1=[{ key: "Ongoing", y: 20 },
{ key: "completed", y: 0 }];
这里是用于将键显示为工具提示数据的工具提示功能。
$scope.toolTipContentFunction = function(){
return function(key, x, y, e, graph) {
return '<h1>' + key + '</h1>'
}
}
【问题讨论】:
标签: javascript svg d3.js pie-chart nvd3.js