Javascript 当图表有两行时,Jqplot工具提示值不正确
我有一个jqplot图表,有两条线。我正在使用tooltipContentEditor修改工具提示中显示的文本。在添加第二行之前,工具提示将精细地显示值。现在我添加了另一行,工具提示总是显示第二行的数据,因此第一行的数据不正确。如何显示正确的值 蓝线工具提示显示黄线值: 内部的图表初始化工具IPContentEditor函数:Javascript 当图表有两行时,Jqplot工具提示值不正确,javascript,jquery,jqplot,Javascript,Jquery,Jqplot,我有一个jqplot图表,有两条线。我正在使用tooltipContentEditor修改工具提示中显示的文本。在添加第二行之前,工具提示将精细地显示值。现在我添加了另一行,工具提示总是显示第二行的数据,因此第一行的数据不正确。如何显示正确的值 蓝线工具提示显示黄线值: 内部的图表初始化工具IPContentEditor函数: $.jqplot('mychart', [coords, paidCoords], { //title:'Sales for ' + name,
$.jqplot('mychart', [coords, paidCoords], {
//title:'Sales for ' + name,
animate: !$.jqplot.use_excanvas,
axesDefaults: {
tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
},
axes:{
xaxis:{
renderer:$.jqplot.DateAxisRenderer,
tickInterval: tickInterval,
tickOptions: { formatString: formatString, angle: -30 }
},
yaxis:{
min:0
}
},
highlighter: {
show: true,
sizeAdjust: 7.5,
tooltipContentEditor: function(str, pointIndex, index, plot){
console.log('logging in tooltipeditor');
console.log(str);
console.log(pointIndex);
console.log(index);
console.log(plot);
var splitted = plot._plotData[1][index];
var x = splitted[0];
var y = splitted[1];
x = new Date(x);
x = x.toString();
return x + "<br/>$" + y;
}
},
cursor:{
show: true,
zoom:true,
showTooltip:false
}
});
别客气!我知道了!在tooltipContentEditor函数中,我需要执行以下操作:
var splitted = str.split(",");
与此相反:
var splitted = plot._plotData[1][index];
实际上,有人知道如何获得工具提示来显示原始数据吗?str显示格式化的日期。