我遇到了同樣的事情,並出現一個解決方案上來爲我的場景工作。
在渲染圖表之後,我查看一系列已經右對齊的dataLabels,然後使用jQuery將它們更改爲白色。
// snipped: rendering the chart
var chart = $('#chartContainer').highcharts(),
labels = $('#chartContainer').find(".highcharts-data-labels tspan"),
indexesNeedingWhite = [];
$.each(chart.series[0].data, function (index, data) {
if (data.dataLabel.alignOptions.align === "right") {
indexesNeedingWhite.push(index);
}
});
// find the exact text label within this container
// and change the fill to white
$.each(indexesNeedingWhite, function (i, index) {
$(labels[index]).css('fill', 'white');
});
對,當你這樣做時,標籤可以擴展到表格邊界之外。我目前的解決方案是讓圖表對齊,然後爲標籤提供backgroundColor。我可能會在背景上放一個邊框以使其更加清晰可見,但還沒有這樣做。 – ramblingWrecker
最好和最簡單的答案,但屬性翻轉。他們應該是'溢出:'沒有',裁剪:假'。 –