Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
If statement Highcharts工具提示格式化程序函数未在表中正确显示值_If Statement_Highcharts_Html Table_Tooltip_Formatter - Fatal编程技术网

If statement Highcharts工具提示格式化程序函数未在表中正确显示值

If statement Highcharts工具提示格式化程序函数未在表中正确显示值,if-statement,highcharts,html-table,tooltip,formatter,If Statement,Highcharts,Html Table,Tooltip,Formatter,我在highcharts tooltip formatter函数中创建了一个if else语句,以便显示来自不同point.series.name的y值。 数组中第一个系列和第二个系列的值显示正确,但最后一个系列的样式名称值(后向投影-排列)显示不正确,因为不显示字体大小和point.series.color。我想问题是表格标签?请看小提琴 工具提示:{ 分享:是的, 是的, 格式化程序:函数(){ var aYearFromNow=新日期(this.x); aYearFromNow.setF

我在highcharts tooltip formatter函数中创建了一个if else语句,以便显示来自不同point.series.name的y值。 数组中第一个系列和第二个系列的值显示正确,但最后一个系列的样式名称值(后向投影-排列)显示不正确,因为不显示字体大小和point.series.color。我想问题是表格标签?请看小提琴

工具提示:{
分享:是的,
是的,
格式化程序:函数(){
var aYearFromNow=新日期(this.x);
aYearFromNow.setFullYear(aYearFromNow.getFullYear()+5);
变量工具提示=“”+
Highcharts.dateFormat('%e/%b/%Y',新日期(this.x))+'-'+Highcharts.dateFormat('%e/%b/%Y',aYearFromNow)+'
; //循环此中的每个点。点 $.each(this.points,function(i,point){ 如果(point.series.name==='Observations'){ 工具提示+=''+point.series.name+':'+ ''+point.y+'℃'+'' }else if(point.series.name===‘箱线图’){ 常数x=这个.x; const currentData=this.series.data.find(data=>data.x==x); const-boxplotValues=currentData?currentData.options:{}; 工具提示+=` 最大值:${boxplotValues.high.toFixed(2)}
Q3:${boxplotValues.Q3.toFixed(2)}
中值:${boxplotValues.Median.toFixed(2)}
Q1:${boxplotValues.Q1.toFixed(2)}
低:${boxplotValues.Low.toFixed(2)}
`; }否则{ 工具提示+=''+point.series.name+':'+ ''+point.point.low++'℃-''+point.point.high++'''+ ''; } }); 返回工具提示; } },
您将在最后一个值(后向广播-排列)之前关闭
tbody
,一旦将其置于for循环之外,它将工作:

...
    tooltip += '<tr><th style="font-size: 14px; color: ' + point.series.color + '">' + point.series.name + ': </th>' +
               '<td style="font-size: 14px">' + point.point.low + '℃ -' + point.point.high + '℃' + '</td></tr>'
    }
});
tooltip += '</tbody></table>';
return tooltip;
...
。。。
工具提示+=''+point.series.name+':'+
''+point.point.low++'℃-''+point.point.high++'''
}
});
工具提示+='';
返回工具提示;
...

这是一个很容易解决的问题。我不知道它是这样工作的。非常感谢!
...
    tooltip += '<tr><th style="font-size: 14px; color: ' + point.series.color + '">' + point.series.name + ': </th>' +
               '<td style="font-size: 14px">' + point.point.low + '℃ -' + point.point.high + '℃' + '</td></tr>'
    }
});
tooltip += '</tbody></table>';
return tooltip;
...