在示例中,图例标题“城市”在水平方向上向左对齐。有什么办法可以使标题与图例区域的中心水平对齐?
legend: {
title: {
text: 'City<br/><span style="font-size: 9px; color: #666; font-weight: normal">(Click to hide)</span>',
style: {
fontStyle: 'italic'
}
}
},
在上面的图例标题中编辑样式似乎没有任何作用。
示例:http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/legend/title/
谢谢。
坚强的。
我唯一能想到的就是在图表加载时以编程方式进行操作:
function(){
var legWidth = this.legend.maxItemWidth; // width of legend
$.each(this.legend.title.element.children[0].children, function(i,j){
j = $(j); // for each span in title
var spanWidth = j.width();
j.attr('dx', (legWidth / 2) - (spanWidth / 2)); // move it to center
});
}
更新小提琴。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句