Javascript 在nvd3饼图中显示两个标签
我需要在nvd3中显示标签内部和外部饼图。 我想想象一下 但我只能显示一个标签 这是我使用的代码:Javascript 在nvd3饼图中显示两个标签,javascript,d3.js,nvd3.js,pie-chart,Javascript,D3.js,Nvd3.js,Pie Chart,我需要在nvd3中显示标签内部和外部饼图。 我想想象一下 但我只能显示一个标签 这是我使用的代码: chart = nv.models.pieChart() .x(function(d) { return $translate.instant(d.label); }) .y(function(d) { return d.value }) .showLabels(true) //Display pie labels .color(function(d) {
chart = nv.models.pieChart()
.x(function(d) {
return $translate.instant(d.label);
})
.y(function(d) { return d.value })
.showLabels(true) //Display pie labels
.color(function(d) {
return myColors[d.label];
})
.labelThreshold(.05) //Configure the minimum slice size for labels to show up
.labelType("percent") //Configure what type of data to show in the label. Can be "key", "value" or "percent"
.pieLabelsOutside(true)
.donut(true) //Turn on Donut mode. Makes pie chart look tasty!
.donutRatio(0.05) //Configure how big you want the donut hole size to be.
;