[英]Highcharts vertical align legend symbol
I'm doing some highcharts and I use 40×40 images as the legend labels. 我正在做一些高级图表,我使用40×40图像作为图例标签。 However, the legend symbols are vertically top-aligned.
但是,图例符号是垂直顶部对齐的。 ( fiddle )
( 小提琴 )
legend: {
align: 'right',
verticalAlign: 'middle',
layout: 'vertical',
labelFormatter: function () {
return $('<div>').append($('<img>').attr('src', 'http://doc.jsfiddle.net/_downloads/jsfiddle-logo.png').css({
height: 40,
width: 40
})).html();
},
useHTML: true
}
Is there some easy way to vertically center-align the legend symbols? 是否有一些简单的方法来垂直居中对齐图例符号?
You can wrap positionItem
function, to post-translate items to be in the middle: http://jsfiddle.net/6fgMp/3/ 你可以包装
positionItem
函数,将项目翻译成中间文件: http : //jsfiddle.net/6fgMp/3/
(function(H){
H.wrap(H.Legend.prototype, 'positionItem', function(proceed, item){
proceed.call(this, item);
if(item.legendSymbol) {
item.legendSymbol.translate(0, 10);
}
if(item.legendLine){
item.legendLine.translate(0, 10);
}
});
})(Highcharts);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.