我使用Highcharts创建了一个图表。绘制在X轴上绘制线条。我想在对面显示情节线而不是默认
我的代码是
plotLines: [{
value: pur_time,
width: 2 ,
color: '#656568',
dashStyle: 'dash',
id: 'plotline',
label: {
text: 'Purchase deadline',
style: {
color: '#656568',
fontWeight: 'bold'
}
}
},{
value: exp_time,
width: 2 ,
color: '#A28F29',
id: 'plotline1',
label: {
text: 'Expiration time',
opposite: true,
style: {
color: '#686A3B',
fontWeight: 'bold'
}
}
}]
以下是我实际得到的样本
我期待的样子是
答案 0 :(得分:2)
尝试绘制线标签的rotation
属性(请参阅http://api.highcharts.com/highcharts#xAxis.plotLines.label.rotation)。
我修改了API文档中的演示小提琴以匹配您要查找的内容:http://jsfiddle.net/brightmatrix/kuyy5p6f/
label: {
text: 'Plot line',
verticalAlign: 'middle',
textAlign: 'center',
rotation: 270,
x: -5
}
在这种情况下,我将rotation
设置为270
以将其翻转,并设置x
值-5
以将其推向左侧。
我希望这有用!