Highcharts饼图。如何在两行中设置标签 [英] Highcharts Pie Chart.How to set labels in two lines
本文介绍了Highcharts饼图。如何在两行中设置标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在highcharts中创建了一个饼形图。
I'm creating a pie chart in highcharts.
有没有人知道如何在两行中设置数据标签?
Does anybody know how to set data labels in two lines?
当数据标签太长时,我发现这个问题。
I'm finding this problem when the data labels are too long.
http://jsfiddle.net/larrytron/fSjnD/
$(function () {
$('#container').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: 'Browser market shares at a specific website, 2010'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
color: '#000000',
maxStaggerLines:1,
connectorColor: '#000000',
format: '<b>{point.name}</b>: {point.percentage:.1f} %'
},
}
},
series: [{
type: 'pie',
name: 'Browser share',
data: [
['Firefox jandler glander gramenauer gramen', 45.0],
['IE', 26.8],
{
name: 'Chrome',
y: 12.8,
sliced: true,
selected: true
},
['Safari', 8.5],
['Opera', 6.2],
['Others', 0.7]
]
}]
});
});
推荐答案
您可以简单地设置dataLabels的宽度, a href =http://jsfiddle.net/Fusher/fSjnD/1/> http://jsfiddle.net/Fusher/fSjnD/1/
You can simply set width for dataLabels, see: http://jsfiddle.net/Fusher/fSjnD/1/
style: {
width: '100px'
}
这篇关于Highcharts饼图。如何在两行中设置标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文