【发布时间】:2015-06-12 20:21:24
【问题描述】:
我正在使用角度 nvd3 饼图。任何想法或建议如何在圆环图的中心添加静态或动态标题?
这里是代码块。
<nvd3-pie-chart
data="exampleData" id="exampleId" showLabels="true" x="xFunction()" y="yFunction()" donut="true" donutRatio=".5" donutLabelsOutside="true">
</nvd3-pie-chart>
function ExampleCtrl($scope){
$scope.exampleData = [
{
key: "One",
y: 5
},
{
key: "Two",
y: 2
}
];
$scope.xFunction = function(){
return function(d) {
return d.key;
};
}
$scope.yFunction = function(){
return function(d) {
return d.y;
};
}
}
【问题讨论】:
-
尝试准备plunker或fiddle,你可能会更快得到答案:)
标签: javascript angularjs nvd3.js angularjs-nvd3-directives