对齐在Highcharts在图例中的文本(Aligning the text in Legend i

2019-09-01 10:30发布

目前传说对齐文本左侧。 即( - 表示项目标签,在大多数情况下将只是不同的颜色。

 ___________________
[-- Legend item 2   ]
[-- Legend item 3   ]
[-- Legend item 244 ]

我想它,以免它它它像这样

 ___________________
[--   Legend item 2 ] 
[--   Legend item 3 ]
[-- Legend item 244 ]

我试着用itemStyle玩弄:textAlign设置:“正确的”,但没有运气。 这甚至可能吗?

Answer 1:

您可以设置useHTML,然后定义宽度和文本对齐:

http://jsfiddle.net/5gjfW/2/

.highcharts-legend-item span {
    width:70px!important;
    text-align:right!important;
}

http://api.highcharts.com/highcharts#legend.useHTML



文章来源: Aligning the text in Legend in Highcharts
标签: highcharts