图例中的 UseHTML=True 忽略点击时的 itemWidth
UseHTML=True in legend ignores itemWidth on click
话又说回来,我正在努力处理饼图。
当我将 useHTML 用作 true 时,它会完全按照我的意愿呈现(也尊重 itemWidth),但是当我单击图例时,它会停止尊重 itemWidth 并且项目重叠。 JSFiddle
代码:
$(function () {
$('#container').highcharts({
chart: {
renderTo: 'container',
height: 660,
width: 400,
},
title: {
text: 'Example',
},
plotOptions: {
pie: {
center: [200, 50],
size: '150',
innerSize: '75%',
dataLabels: {
enabled: false,
},
showInLegend: true
}
},
legend: {
useHTML:true,
verticalAlign: 'top',
floating: true,
itemWidth: 180,
y: 200,
itemStyle: {
fontSize:'12px',
fontWeight: 'light',
width: 160
}
},
series: [{
type: 'pie',
data: [['Aaaaaaaaaaaaa aaaaaaaaaaaaa',0.0516218483578],['bbbbbbbbbbbbbb bbbbbbbbbbbbbbbb ',0.257286564668],['cccccccccccccccccc',1.12221284311],['dddddddd ddddddddd',1.1265250728],['rrrrrrr rrrrrrrrrrr',0.17346294958],['Aaaaaaaaaaaaa aaaaaaaaaaaaa ',1.20890386677],['ffffffff ',0.459460369787],['gfdgdfgdfg ',6.13592008543],['Aaaaaaaaaaaaa aaaaaaaaaaaaa ',0.395214054153],['Aaaaaaaaaaaaa aaaaaaaaaaaaa',0.366061664716],['dddddddddd',0.149098291043],['Aaaaaaaaaaaaa aaaaaaaaaaaaa',0.0957028394272],['tttttttttttt ',3.48603058953],['Aaaaaaaaaaaaa aaaaaaaaaaaaa',1.6316529146],['fdsfsdfsd .',1.34404210477],['Aaaaaaaaaaaaa aaaaaaaaaaaaa',0.350541259163],['Aaaaaaaaaaaaa aaaaaaaaaaaaas ',0.45563482302],['gdffdgdgg ',0.601007305701],['Aaaaaaaaaaaaa aaaaaaaaaaaaa',1.07655357912],['Aaaaaaaaaaaaa aaaaaaaaaaaaa ',0.145888955634],['Aaaaaaaaaaaaa aaaaaaaaaaaaa',13.0487584317],['dasdasfsafsaf',1.79394965159],['Vesdfsdrde ',3.41252042196],['Aaaaaaaaaaaaa aaaaaaaaaaaaa ',0.258638673662],],
}]
});
});
如何在单击图例后仍保留格式?
看来这个错误在最近的版本中已经解决了。
话又说回来,我正在努力处理饼图。
当我将 useHTML 用作 true 时,它会完全按照我的意愿呈现(也尊重 itemWidth),但是当我单击图例时,它会停止尊重 itemWidth 并且项目重叠。 JSFiddle 代码:
$(function () {
$('#container').highcharts({
chart: {
renderTo: 'container',
height: 660,
width: 400,
},
title: {
text: 'Example',
},
plotOptions: {
pie: {
center: [200, 50],
size: '150',
innerSize: '75%',
dataLabels: {
enabled: false,
},
showInLegend: true
}
},
legend: {
useHTML:true,
verticalAlign: 'top',
floating: true,
itemWidth: 180,
y: 200,
itemStyle: {
fontSize:'12px',
fontWeight: 'light',
width: 160
}
},
series: [{
type: 'pie',
data: [['Aaaaaaaaaaaaa aaaaaaaaaaaaa',0.0516218483578],['bbbbbbbbbbbbbb bbbbbbbbbbbbbbbb ',0.257286564668],['cccccccccccccccccc',1.12221284311],['dddddddd ddddddddd',1.1265250728],['rrrrrrr rrrrrrrrrrr',0.17346294958],['Aaaaaaaaaaaaa aaaaaaaaaaaaa ',1.20890386677],['ffffffff ',0.459460369787],['gfdgdfgdfg ',6.13592008543],['Aaaaaaaaaaaaa aaaaaaaaaaaaa ',0.395214054153],['Aaaaaaaaaaaaa aaaaaaaaaaaaa',0.366061664716],['dddddddddd',0.149098291043],['Aaaaaaaaaaaaa aaaaaaaaaaaaa',0.0957028394272],['tttttttttttt ',3.48603058953],['Aaaaaaaaaaaaa aaaaaaaaaaaaa',1.6316529146],['fdsfsdfsd .',1.34404210477],['Aaaaaaaaaaaaa aaaaaaaaaaaaa',0.350541259163],['Aaaaaaaaaaaaa aaaaaaaaaaaaas ',0.45563482302],['gdffdgdgg ',0.601007305701],['Aaaaaaaaaaaaa aaaaaaaaaaaaa',1.07655357912],['Aaaaaaaaaaaaa aaaaaaaaaaaaa ',0.145888955634],['Aaaaaaaaaaaaa aaaaaaaaaaaaa',13.0487584317],['dasdasfsafsaf',1.79394965159],['Vesdfsdrde ',3.41252042196],['Aaaaaaaaaaaaa aaaaaaaaaaaaa ',0.258638673662],],
}]
});
});
如何在单击图例后仍保留格式?
看来这个错误在最近的版本中已经解决了。