Javascript 如何在highcharts图表的工具提示中插入数据?
我有一个这种类型的json文件:Javascript 如何在highcharts图表的工具提示中插入数据?,javascript,json,charts,highcharts,Javascript,Json,Charts,Highcharts,我有一个这种类型的json文件: [["SSL Certificate Signed Using Weak Hashing Algorithm",4500,"98","10980"],["SSL Self-Signed Certificate",2000,"98","-1"],...] 以及javascript代码: $(document).ready(function()
[["SSL Certificate Signed Using Weak Hashing Algorithm",4500,"98","10980"],["SSL Self-Signed Certificate",2000,"98","-1"],...]
以及javascript代码:
$(document).ready(function() {
var options = {
chart: {renderTo:'grafico1',type:'column'},
series: [{ }]
};
$.getJSON('json.json', function(data){
options.series[0].data = data;
var chart = new Highcharts.Chart(options);
});
});
在生成的图形中,列完美地表示数组的数值。除了数值之外,数组的第一个元素也会正确显示在工具提示中。我想让数组的第三和第四个元素出现在工具提示中,我该怎么做
tooltip.formatter
回调设置显示的工具提示的格式工具提示:{
格式化程序(){
让输出=`${this.key}
`+`● ${this.series.name}:${this.y}
值:${this.point.value}
值1:${this.point.value1}`
返回输出
}
},
API:
API:
tooltip: {
formatter() {
let output = `<span style="font-size: 10px">${this.key}</span><br/>` + `<span style="color:${this.color}">●</span> ${this.series.name}: <b>${this.y}</b><br/> value: ${this.point.value} <br/> value1: ${this.point.value1}`
return output
}
},