Javascript 海图中的工具提示
我有一个函数,它可以绘制柱形图。我想在工具提示中添加额外信息 这是我的功能Javascript 海图中的工具提示,javascript,jquery,highcharts,Javascript,Jquery,Highcharts,我有一个函数,它可以绘制柱形图。我想在工具提示中添加额外信息 这是我的功能 function arm_bar_graph(result){ $('#arms_graph').highcharts({ chart: { type: 'column', backgroundColor : '#fafafa', height : 300, }, title: {
function arm_bar_graph(result){
$('#arms_graph').highcharts({
chart: {
type: 'column',
backgroundColor : '#fafafa',
height : 300,
},
title: {
text: 'Load Per Arm / Open Shipments'
},
subtitle: {
text: ''
},
xAxis: {
categories: result[0],
labels: {
rotation: -45,
align: 'right',
style: {
fontSize: '13px',
fontFamily: 'Verdana, sans-serif'
}
}
},
yAxis: {
min: 0,
title: {
text: ''
}
},
tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y}</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
credits: {
enabled: false
},
series: [{
data: result[1],
name : 'Open Shipments',
},
]
});
}
我想向工具提示中添加更多信息,工具提示包含在结果中提供的词典中。我该怎么做?当前,工具提示显示Y轴值,即结果[1]值
如何从字典中添加值?您可以使用
工具提示.formatter
回调进行添加
工具提示格式化程序回调代码:
tooltip: {
formatter: function() {
return 'The value for <b>' + this.x + '</b> is <b>' + this.y + '</b>, in series '+ this.series.name;
}
}
工具提示:{
格式化程序:函数(){
返回“+this.x+”的值为“+this.y+”,在序列“+this.series.name”中;
}
}
REF:
tooltip: {
formatter: function() {
return 'The value for <b>' + this.x + '</b> is <b>' + this.y + '</b>, in series '+ this.series.name;
}
}
快乐编码:)您可以使用
tooltip.formatter
回调
工具提示格式化程序回调代码:
tooltip: {
formatter: function() {
return 'The value for <b>' + this.x + '</b> is <b>' + this.y + '</b>, in series '+ this.series.name;
}
}
工具提示:{
格式化程序:函数(){
返回“+this.x+”的值为“+this.y+”,在序列“+this.series.name”中;
}
}
REF:
tooltip: {
formatter: function() {
return 'The value for <b>' + this.x + '</b> is <b>' + this.y + '</b>, in series '+ this.series.name;
}
}
快乐编码:)来自@dreamweiver示例 我需要以下内容,因为我的this.x显示为一个巨大的数字,例如1395187200000现在显示为2014年2月6日星期四
Highcharts.dateFormat('%A, %b %e, %Y', this.x)
根据@dreamweiver示例 我需要以下内容,因为我的this.x显示为一个巨大的数字,例如1395187200000现在显示为2014年2月6日星期四
Highcharts.dateFormat('%A, %b %e, %Y', this.x)