对齐在Highcharts图例中的文字 [英] Aligning the text in Legend in Highcharts
本文介绍了对齐在Highcharts图例中的文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
___________________
[ - Legend项目2]
[ - 图例项目3]
[ - 图例项目244]
我希望它能像这样
___________________
[ - 图例项目2]
[ - 图例3]
[ - 图例244]
我尝试过使用itemStyle:textAlign:'right'但没有运气,这甚至有可能吗?
解决方案
您可以设置useHTML,然后定义宽度和文本对齐:
.highcharts-legend-item span {
width:70px!important;
text-align:right!important;
}
http://api.highcharts.com/highcharts#legend.useHTML
Currently the legend aligns the text to the left. I.e (-- indicates item label and in most cases would be just different colors.
___________________
[-- Legend item 2 ]
[-- Legend item 3 ]
[-- Legend item 244 ]
I would like it so that it does it it like this
___________________
[-- Legend item 2 ]
[-- Legend item 3 ]
[-- Legend item 244 ]
I tried playing around with itemStyle: textAlign: 'right' but no luck. Is this even possible?
解决方案
You can set useHTML and then define width and text-align:
.highcharts-legend-item span {
width:70px!important;
text-align:right!important;
}
http://api.highcharts.com/highcharts#legend.useHTML
这篇关于对齐在Highcharts图例中的文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文