如果面积很小,则在甜甜圈图中标签会重叠。如何使用线条将数据标签放置在甜甜圈图的外部。目前,我能够在图表内绘制标签。从此处找到示例代码:
$(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
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句