嗨,我正在尝试将标题放置在“顶部”,并使用caption.margin属性控制标题和plotArea之间的边距。完美适用于“底部”对齐的字幕,但不适用于“顶部”对齐的字幕。请指教。这是一个示例https://jsfiddle.net/sabira/e7kdz32v/11/:
Highcharts.chart('container', {
title: {
text: ''
},
xAxis: {
categories: ['Apples', 'Pears', 'Bananas', 'Oranges']
},
series: [{
data: [1, 4, 3, 5],
type: 'column',
name: 'Fruits'
}],
caption: {
verticalAlign: 'top',
margin: 100,
text: '<b>The caption renders in the top, and is part of the exported chart.</b>'
}
});
答案 0 :(得分:0)
以相反的方式用作标题的空白:http://jsfiddle.net/BlackLabel/4w3az2qd/。作为解决方案,可以使用caption
样式的title
,subtitle
或caption
来代替padding-bottom
:
caption: {
verticalAlign: 'top',
useHTML: true,
style: {
'padding-bottom': '100px'
},
text: '<b>The caption renders in the top, and is part of the exported chart.</b>'
}
实时演示: https://jsfiddle.net/BlackLabel/j8gv1k9L/
API参考: https://api.highcharts.com/highcharts/caption.useHTML