如果区域非常小,则标签会在圆环图中重叠。 如何用线条将数据标签放置在圆环图外部。 目前我可以在图表内绘制标签。从这里找到示例代码:
$(document).ready(function(){
var s1 = [['a',6], ['b',8], ['c',14], ['d',20]];
var plot3 = $.jqplot('chart4', [s1], {
seriesDefaults: {
// make this a donut chart.
renderer:$.jqplot.DonutRenderer,
rendererOptions:{
// Donut's can be cut into slices like pies.
sliceMargin: 3,
// Pies and donuts can start at any arbitrary angle.
startAngle: -90,
showDataLabels: true,
// By default, data labels show the percentage of the donut/pie.
// You can show the data 'value' or data 'label' instead.
dataLabels: 'value'
}
}
});
});
这是我的预期输出:
非常感谢帮助
最佳答案
好的,您需要设置的是:
dataLabelPositionFactor: 2
请在此处查看 jsFiddle:
更多信息请参见此处:
http://www.jqplot.com/docs/files/plugins/jqplot-donutRenderer-js.html
更新
我还会设置填充以避免重叠,即
padding: 50
关于javascript - 如何使用 jqplot 将数据标签放置在带有线条的圆环图之外?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21456614/