我只想让我的传奇名称值左对齐,百分比值右对齐,我已连续工作了两天,并在论坛上打开了几个不同的问题,得到了0个答案,所以任何人有任何知识我都会爱你的帮助!非常感谢你 http://jsfiddle.net/hAnCr/2/
$("document").ready(
function(){
$('#container').highcharts({
chart:{
type:'pie',
height: 300,
width: 400
},
credits:{enabled: false},
colors:[
'#5485BC', '#AA8C30', '#5C9384', '#981A37', '#FCB319', '#86A033', '#614931', '#00526F', '#594266', '#cb6828', '#aaaaab', '#a89375'
],
title:{text: null},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
showInLegend: true,
dataLabels: {
enabled: false,
formatter: function() {
return this.percentage.toFixed(2) + '%';
}
}
}
},
legend: {
enabled: true,
layout: 'vertical',
align: 'right',
width: 200,
verticalAlign: 'middle',
useHTML: true,
labelFormatter: function() {
return '<div style="text-align: left; width:130px;">' + this.name + '</div><div style="width:40px; text-align:right;">' + this.y + '%</div>';
}
},
series: [{
type: 'pie',
dataLabels: {
},
data: [
['Domestic Equity', 38.5],
['International Equity', 26.85],
['Other', 15.70],
['Cash and Equivalents', 10.48],
['Fixed Income', 8.48]
]
}]
});
});
答案 0 :(得分:12)
你应该设置float:left;对于传说中的两个div。
labelFormatter: function() {
return '<div style="text-align: left; width:130px;float:left;">' + this.name + '</div><div style="width:40px; float:left;text-align:right;">' + this.y + '%</div>';