我正在使用 HighCharts 组合图来比较预测值(由线表示)和累积值(由列表示)。累计值每周都在增加,我想看看它是否达到了预测值。
我在这个js fiddle 中创建了一个图表,http://jsfiddle.net/aroauy4t/ 。 我在下面展示了 js 代码。
$(function () {
$('#container').highcharts({
title: {
text: 'Forecast Vs Cumulative chart'
},
xAxis: {
categories: [' ', ' ', 'Bananas', ' ', ' ']
},
labels: {
items: [{
style: {
left: '50px',
top: '18px',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
}
}]
},
series: [{
type: 'column',
name: 'Cumulative',
data: [0, 0, 5, 0, 0]
}, {
type: 'line',
name: 'Forecast',
data: [3, 3, 3, 3, 3],
marker: {
lineWidth: 2,
lineColor: Highcharts.getOptions().colors[3],
fillColor: 'white'
}
}]
});
});
但是,当 x 轴不包含如下图所示的标签时,工具提示内容会溢出。
如何让工具提示在没有任何溢出的情况下运行(如下图所示)
最佳答案
您还可以使用tooltip - useHTML属性(property)。 打开后,工具提示将呈现为异常(exception)。
tooltip: {
useHTML: true
}
关于javascript - 无法在 HighCharts 中正确定位工具提示内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29512975/