Javascript 未为绘图线和图表渲染标签
我正在尝试在海图上渲染绘图线。但不知何故,我无法在绘图线上渲染标签 以下是代码片段:Javascript 未为绘图线和图表渲染标签,javascript,highcharts,Javascript,Highcharts,我正在尝试在海图上渲染绘图线。但不知何故,我无法在绘图线上渲染标签 以下是代码片段: var chart = new Highcharts.Chart({ chart: { renderTo: 'view_content', type: 'line' }, title: { text: 'Dummy Data by Region' }, xAxi
var chart = new Highcharts.Chart({
chart: {
renderTo: 'view_content',
type: 'line'
},
title: {
text: 'Dummy Data by Region'
},
xAxis: {
categories: ['Africa', 'America', 'Asia']
},
yAxis: {
plotLines:[{
value:450,
color: '#ff0000',
width:2,
zIndex:4,
label:{text:'goal',verticalAlign: 'bottom',
textAlign: 'right',}
}]
},
series: [{
name: 'Year 1800',
data: [107, 31, 50]
},
{
name: 'Goal',
type: 'scatter',
marker: {
enabled: true
},
data: [450]
}]
});
绘制完图表后,我调用addPlotLines函数
chart.yAxis[0].addPlotLine({
value: 35.5,
color: 'green',
width: 2,
id: 'plot-line-1',
label:{text:"Testing"}
});
正在渲染打印线,但其上的标签未渲染。
我有什么遗漏吗
Jquery版本:3.1.0
Highcharts版本:6.0.3此问题是一个错误,报告如下: 要使其在低于6.1.1的版本中工作,请使用此解决方法:
Highcharts.wrap(Highcharts.Axis.prototype, 'getPlotLinePath', function(proceed) {
var path = proceed.apply(this, Array.prototype.slice.call(arguments, 1));
if (path) {
path.flat = false;
}
return path;
});
现场演示:在这种情况下,一切正常。也许您有一些CSS/JS代码将标签呈现为白色。@Core972请注意Highcharts 6.0.3。不是最新版本。我想fiddle使用的是6.1.4。@adithya vin,如果这是highcharts的错误,唯一的解决方案是更新到新版本。此错误已在6.1.1版本中修复。
fixed#8477,打印线标签在支持Array.prototype.flat的浏览器中不起作用。